[GRASS-SVN] r44678 - in grass-promo/tutorials: . grass_modis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 22 19:59:00 EST 2010


Author: ychemin
Date: 2010-12-22 16:59:00 -0800 (Wed, 22 Dec 2010)
New Revision: 44678

Added:
   grass-promo/tutorials/grass_modis/
   grass-promo/tutorials/grass_modis/GRASSnews.sty
   grass-promo/tutorials/grass_modis/Makefile
   grass-promo/tutorials/grass_modis/README
   grass-promo/tutorials/grass_modis/WIST_datasets.png
   grass-promo/tutorials/grass_modis/article_GIPE.tex
   grass-promo/tutorials/grass_modis/grass_osgeo_logo.jpg
   grass-promo/tutorials/grass_modis/i_modis_qc.png
   grass-promo/tutorials/grass_modis/main_document.tex
Log:
Added Basic MODIS tutorial

Added: grass-promo/tutorials/grass_modis/GRASSnews.sty
===================================================================
--- grass-promo/tutorials/grass_modis/GRASSnews.sty	                        (rev 0)
+++ grass-promo/tutorials/grass_modis/GRASSnews.sty	2010-12-23 00:59:00 UTC (rev 44678)
@@ -0,0 +1,186 @@
+%%
+%% DO NOT EDIT THIS FILE!
+%%
+%% This is file `GRASSnews.sty',
+%% derived from 'RNews.sty' file
+%% kindly provided by the R Project..
+%%
+\def\fileversion{v0.2}
+\def\filename{GRASSnews}
+\def\filedate{2004/08/06}
+\def\docdate {2001/10/31}
+%%
+%% Package `GRASSnews' to use with LaTeX2e
+%% Copyright (C) 2004 GRASS Development Team
+%%
+%% -*- LaTeX -*-
+\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+\ProvidesPackage{\filename}[\filedate\space\fileversion\space
+                        GRASSnews package]
+\typeout{Package: `\filename\space\fileversion \@spaces <\filedate>'}
+\typeout{English documentation as of <\docdate>}
+\RequirePackage{ifthen}
+\newboolean{GRASSnews at driver}
+\DeclareOption{driver}{\setboolean{GRASSnews at driver}{true}}
+\DeclareOption*{\PackageWarning{\filename}{Unknown option
+    `\CurrentOption'}}
+\ProcessOptions\relax
+\ifthenelse{\boolean{GRASSnews at driver}}{}{
+\RequirePackage{multicol,graphicx,color,fancyhdr,hyperref}
+\newcommand{\volume}[1]{\def\GRASSnews at volume{#1}}
+\newcommand{\volnumber}[1]{\def\GRASSnews at number{#1}}
+\renewcommand{\date}[1]{\def\GRASSnews at date{#1}}
+\setcounter{secnumdepth}{-1}
+\renewcommand{\author}[1]{\def\GRASSnews at author{#1}}
+\renewcommand{\title}[1]{\def\GRASSnews at title{#1}}
+\newcommand{\subtitle}[1]{\def\GRASSnews at subtitle{#1}}
+\newenvironment{article}{%
+  \author{}\title{}\subtitle{}}{\end{multicols}}
+\renewcommand{\maketitle}{
+  \begin{multicols}{2}[\chapter{\GRASSnews at title}\refstepcounter{chapter}][3cm]
+    \ifx\empty\Rnews at subtitle\else\noindent\textbf{\GRASSnews at subtitle}
+    \par\nobreak\addvspace{\baselineskip}\fi
+    \ifx\empty\GRASSnews at author\else\noindent\textit{\GRASSnews at author}
+    \par\nobreak\addvspace{\baselineskip}\fi
+    \@afterindentfalse\@nobreaktrue\@afterheading}
+\renewcommand\chapter{\secdef\GRASSnews at chapter\@schapter}
+\providecommand{\nohyphens}{%
+  \hyphenpenalty=10000\exhyphenpenalty=10000\relax}
+\newcommand{\GRASSnews at chapter}{%
+  \renewcommand{\@seccntformat}[1]{}%
+  \@startsection{chapter}{0}{0mm}{%
+    -2\baselineskip \@plus -\baselineskip \@minus -.2ex}{\p@}{%
+    \normalfont\Huge\bfseries\raggedright}}
+\renewcommand*\l at chapter{\@dottedtocline{0}{0pt}{1em}}
+\def\@schapter#1{\section*#1}
+\renewenvironment{figure}[1][]{%
+  \def\@captype{figure}
+  \noindent
+  \begin{minipage}{\columnwidth}}{%
+  \end{minipage}\par\addvspace{\baselineskip}}
+\renewcommand{\thefigure}{\@arabic\c at figure}
+\renewcommand{\thetable}{\@arabic\c at table}
+\renewcommand{\contentsname}{Contents of this volume:}
+\renewcommand\tableofcontents{%
+  \section*{\contentsname
+    \@mkboth{%
+      \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
+  \@starttoc{toc}}
+\renewcommand{\titlepage}{%
+  \noindent
+  %\rule{\textwidth}{1pt}\\[-.8\baselineskip]
+  %\rule{\textwidth}{.5pt}
+
+  \begin{center}
+    \includegraphics[height=0.75cm]{grass_osgeo_logo}
+    \hspace{7mm}
+    \fontsize{1cm}{1cm}\selectfont
+   FOSSGIS/ Training Manual
+  \end{center}
+%  The Newsletter of the GRASS  Project\hfill
+%\begin{small}
+\textbf{Open Source GIS and Remote Sensing Tutorials}
+%\textbf{G}eographic \textbf{R}esources \textbf{A}nalysis \textbf{S}upport \textbf{S}ystem
+%\end{small}
+\hfill
+  Version \GRASSnews at volume, \GRASSnews at date\\[-.5\baselineskip]
+  \rule{\textwidth}{.5pt}\\[-.7\baselineskip]
+  \rule{\textwidth}{2pt}
+  \vspace{1cm}
+  \fancyhf{}
+  \fancyhead[L]{GRASS-Tutorials}
+  \fancyhead[R]{Ver.~\GRASSnews at volume, \GRASSnews at date}
+  \fancyfoot[R]{\thepage}
+  \thispagestyle{empty}
+  \begin{bottombox}
+    \begin{multicols}{2}
+      \setcounter{tocdepth}{0}
+      \tableofcontents
+      \setcounter{tocdepth}{2}
+    \end{multicols}
+  \end{bottombox}}
+\setlength{\textheight}{240mm}
+\setlength{\topmargin}{0mm}
+\setlength{\textwidth}{17cm}
+\setlength{\oddsidemargin}{-6mm}
+\setlength{\columnseprule}{.1pt}
+\setlength{\columnsep}{20pt}
+\RequirePackage{ae}
+\RequirePackage[T1]{fontenc}
+\renewcommand{\rmdefault}{ppl}
+\renewcommand{\sfdefault}{aess}
+\renewcommand{\ttdefault}{aett}
+\definecolor{Red}{rgb}{0.7,0,0}
+\definecolor{Blue}{rgb}{0,0,0.8}
+\definecolor{hellgrau}{rgb}{0.55,0.55,0.55}
+\newcommand{\R}{R}
+\newcommand{\address}[1]{\addvspace{\baselineskip}\noindent\emph{#1}}
+\newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}}
+\newsavebox{\GRASSnews at box}
+\newlength{\GRASSnews at len}
+\newenvironment{bottombox}{%
+  \begin{figure*}[b]
+    \begin{center}
+      \noindent
+      \begin{lrbox}{\GRASSnews at box}
+        \begin{minipage}{0.99\textwidth}}{%
+        \end{minipage}
+      \end{lrbox}
+      \addtolength{\GRASSnews at len}{\fboxsep}
+      \addtolength{\GRASSnews at len}{\fboxrule}
+      \hspace*{-\GRASSnews at len}\fbox{\usebox{\GRASSnews at box}}
+    \end{center}
+  \end{figure*}}
+\RequirePackage{verbatim}
+\def\boxedverbatim{%
+  \def\verbatim at processline{%
+    {\setbox0=\hbox{\the\verbatim at line}%
+    \hsize=\wd0 \the\verbatim at line\par}}%
+  \@minipagetrue
+  \@tempswatrue
+  \setbox0=\vbox
+  \bgroup\small\verbatim
+}
+\def\endboxedverbatim{%
+  \endverbatim
+  \unskip\setbox0=\lastbox
+  \egroup
+  \fbox{\box0}
+}
+\pagestyle{fancy}
+} % \ifthenelse{\boolean{GRASSnews at driver}}
+\newcommand\code{\bgroup\@codex}
+\def\@codex#1{{\normalfont\ttfamily\hyphenchar\font=-1 #1}\egroup}
+\newcommand{\kbd}[1]{{\normalfont\texttt{#1}}}
+\newcommand{\key}[1]{{\normalfont\texttt{\uppercase{#1}}}}
+\newcommand\samp{`\bgroup\@noligs\@sampx}
+\def\@sampx#1{{\normalfont\texttt{#1}}\egroup'}
+\newcommand{\var}[1]{{\normalfont\textsl{#1}}}
+\let\env=\code
+\newcommand{\file}[1]{{`\normalfont\textsf{#1}'}}
+\let\command=\code
+\let\option=\samp
+\newcommand{\dfn}[1]{{\normalfont\textsl{#1}}}
+\newcommand{\acronym}[1]{{\normalfont\textsc{\lowercase{#1}}}}
+\newcommand{\strong}[1]{{\normalfont\fontseries{b}\selectfont #1}}
+\let\pkg=\strong
+\RequirePackage{alltt}
+\newenvironment{example}{\begin{alltt}}{\end{alltt}}
+\newenvironment{smallexample}{\begin{alltt}\small}{\end{alltt}}
+\newenvironment{display}{\list{}{}\item\relax}{\endlist}
+\newenvironment{smallverbatim}{\small\verbatim}{\endverbatim}
+\providecommand{\operatorname}[1]{%
+  \mathop{\operator at font#1}\nolimits}
+\renewcommand{\P}{%
+  \mathop{\operator at font I\hspace{-1.5pt}P\hspace{.13pt}}}
+\newcommand{\E}{%
+  \mathop{\operator at font I\hspace{-1.5pt}E\hspace{.13pt}}}
+\newcommand{\VAR}{\operatorname{var}}
+\newcommand{\COV}{\operatorname{cov}}
+\newcommand{\COR}{\operatorname{cor}}
+\RequirePackage{amsfonts}
+\endinput
+
+
+%%
+%% End of file `GRASSnews.sty'.

Added: grass-promo/tutorials/grass_modis/Makefile
===================================================================
--- grass-promo/tutorials/grass_modis/Makefile	                        (rev 0)
+++ grass-promo/tutorials/grass_modis/Makefile	2010-12-23 00:59:00 UTC (rev 44678)
@@ -0,0 +1,64 @@
+#convenient Makefile (I think) -MN
+
+#targets:
+#  make           - builds the text
+#  make refcheck  - check \label{} and \ref{} and friends for consistency
+#                   Result is in "latex_refs.log"
+#  make clean     - removed Latex' auxiliary files
+#  make ps        - create PS file
+#  make pdf       - create PDF file
+#  make html      - create HTML files (into GRASSnews_volX/ subdirectory)
+#  make ascii     - extracts ASCII from original ${LATEX} files (into ascii/ subdirectory)
+#  make changelog - creates ChangeLog
+
+FILE=main_document
+LATEX=pdflatex
+
+all:
+	${LATEX} $(FILE)
+	#bibtex $(FILE)
+	#now loop over ${LATEX} files, until stable:
+	echo Rerun > $(FILE).log
+	while grep Rerun $(FILE).log >/dev/null 2>&1 ; do ${LATEX} $(FILE).tex ; done
+
+#check references:
+refcheck: all
+	${LATEX} $(FILE) | grep "undefined" > latex_refs.log
+	#@echo "Bibtex errors:" >> latex_refs.log
+	#bibtex $(FILE) | grep 'find a database' >> latex_refs.log
+	@echo "Check is stored in: latex_refs.log"
+	@cat latex_refs.log
+
+#make PostScript:
+ps: all
+	dvips -o $(FILE).ps $(FILE).dvi
+
+#make PDF:
+pdf: all
+	@#the new converter script has a different name:
+	@(type -p dvipdfpress > /dev/null ; if [ $$? -eq 0 ] ; then dvipdfpress $(FILE).dvi $(FILE).pdf ; else dvipdf $(FILE).dvi $(FILE).pdf ; fi )
+	@echo "Generated: $(FILE).pdf"
+
+html:
+	$(MAKE) all
+	latex2html -init_file l2h.conf  -split=+2 -address "(C) 2005, <a href=http://grass.itc.it/newsletter/>GRASS Newsletter editorial board</a><br>Last modified: `/bin/date +%d-%m-%Y`" $(FILE)
+	@echo "HTML Newsletter generated in ./$(FILE)"
+
+# set to your preferred software such as detex, untex, ...
+DETEX=detex
+ascii:
+	@test -d ascii || mkdir ascii ; true
+	@(for i in *.tex ; do n=`basename $$i .tex` ; ${DETEX} $$i > ascii/$$n.txt ; done)
+	@echo "ASCII newsletter extracted to ./ascii/"
+
+clean:
+	rm -f *.log $(FILE).aux $(FILE).dvi $(FILE).bbl $(FILE).blg $(FILE).out $(FILE).cb $(FILE).toc
+
+veryclean: clean
+	rm -f *~ latex_refs.log *.ps *.pdf
+
+# cvs2cl.pl creates a GNU style ChangeLog file:
+# http://www.red-bean.com/~kfogel/cvs2cl.shtml
+changelog:
+	cvs2cl.pl
+	@echo "Written ChangeLog"

Added: grass-promo/tutorials/grass_modis/README
===================================================================
--- grass-promo/tutorials/grass_modis/README	                        (rev 0)
+++ grass-promo/tutorials/grass_modis/README	2010-12-23 00:59:00 UTC (rev 44678)
@@ -0,0 +1,8 @@
+Document Title:
+  Starter Manual to GRASS GIS
+
+Authors: GRASS Development Team 
+	email: yann.chemin at gmail.com
+
+License: Public Domain or <GPDL for Document, LGPL for script/code if use independently of document>
+

Added: grass-promo/tutorials/grass_modis/WIST_datasets.png
===================================================================
(Binary files differ)


Property changes on: grass-promo/tutorials/grass_modis/WIST_datasets.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: grass-promo/tutorials/grass_modis/article_GIPE.tex
===================================================================
--- grass-promo/tutorials/grass_modis/article_GIPE.tex	                        (rev 0)
+++ grass-promo/tutorials/grass_modis/article_GIPE.tex	2010-12-23 00:59:00 UTC (rev 44678)
@@ -0,0 +1,104 @@
+% Template GRASS newsletter - Article
+% Language: Latex
+%
+
+% Head
+
+\title{Basic MODIS preparation in GRASS GIS}
+\subtitle{Manual}
+\author{GRASS Development Team}
+
+\maketitle
+\section{Downloading free satellite data from Internet}
+Downloading satellite imagery from Internet is now common. From 2009, Landsat-class satellites is having all its imagery freely downloadable online. Terra and Aqua satellites have always been freely downloadable since their launch. Typically, a safe way to start with is to reach the Warehouse Inventory Search Tool (WIST), a NASA website (\href{http://wist.echo.nasa.gov}{wist.echo.nasa.gov}) holding a large amount of free satellite imagery. Below is the initial choice available on WIST.
+\begin{center}
+ \includegraphics[scale=0.17]{WIST_datasets.png}
+\end{center}
+If you are downloading Modis images, be sure to have at hand a proper tool to manipulate the .hdf file format. The Modis Reprojection Tool (MRT) is such a tool and is available at (\href{http://lpdaac.usgs.gov/landdaac/tools/modis/index.asp}{lpdaac.usgs.gov/landdaac/tools/modis/}). MRT can convert to a more standard GeoTiff file format the Modis images. It can also reproject them to more common projection systems than its storage-purpose projection system the Integrated Sinusoidal. Alternatively, you can use a combination of tools from GDAL.\newline\linebreak
+GDAL has a set of small tools that are practical to access information from header file and to perform repeated information on a dataset. You can use gdalinfo (\href{http://www.gdal.org/gdalinfo.html}{www.gdal.org/gdalinfo.html}) for extracting detailed information from the image file header, it extracts proper information about MODIS subdatasets and their naming conventions, add to it gdal\_translate (\href{http://www.gdal.org/gdal\_translate.html}{www.gdal.org/gdal\_translate.html}) to extract specific bands from the HDF format file into single bands common formats like GeoTiff. The script below automatically reads and exports each subdataset of any MODIS HDF file in the directory into a subdirectory called \textit{processed}.\newline
+\begin{smallverbatim}
+#This Unix Shell script automatically 
+# extracts MODIS subdatasets into 
+# processed/ subdirectory as GeoTiff 
+# (*.tif) files
+#-------------------------------------
+mkdir processed
+for file in *.hdf
+do SDS_list=$(gdalinfo $file \
+        | grep "SUBDATASET_.*_NAME.*")
+	for subdataset in $SDS_list
+	do echo ${subdataset#*=}.tif
+	   gdal_translate -of GTiff \
+	      ${subdataset#*=} processed/ \
+	      ${subdataset#*=}.tif
+	done
+done
+\end{smallverbatim}
+Another tool, gdalwarp (\href{http://www.gdal.org/gdalwarp.html}{www.gdal.org/gdalwarp.html}) is dedicated to extract part of images and geolocate them properly. It would reproject the image data, it is useful to note that it also change the file format if you request it to do so. The script below does that with a target projection \textit{EPSG:4326} which actually means the following proj4 crs: \textit{+proj=longlat +ellps=WGS84 +datum=WGS84 +no\_defs}.
+\begin{smallverbatim}
+for file in *.hdf
+do SDS_list=$(gdalinfo $file \
+        | grep "SUBDATASET_.*_NAME.*")
+	for subdataset in $SDS_list
+	do echo ${subdataset#*=}.tif
+	   gdalwarp -of GTiff \
+	      -s_srs '+proj=sinu +R=6371007.181 \
+	      +nadgrids=@null +wktext' \
+	      -t_srs EPSG:4326 ${subdataset#*=} \
+              processed/${subdataset#*=}.tif
+	done
+done
+\end{smallverbatim}
+
+\section{Renaming}
+Most of the time you will want to reduce the size of the MODIS file names. As an example for MOD13Q1 NDVI layer remaning when converting from HDF to TIF, write the following script at the GRASS Command Line Interface:
+
+\begin{smallverbatim}
+root=~/MOD13Q1/2_PreProcessed
+rootNDVI=$root/NDVI/
+for file in MOD13Q1.A2010*.hdf
+do 
+	SDS_list_NDVI=$(gdalinfo $file \
+		| grep "SUBDATASET_1_NAME")
+	echo $file
+	gdal_translate -of GTiff -quiet "${SDS_list_NDVI#*=}" \
+	   $rootNDVI/$(echo ${SDS_list_NDVI#*=} \
+	   | sed 's/\(.*\):\(.*\):"\(.*\).A\(.*\)\.\h \
+	   \(.*\)\.\(.*\)\.\(.*\).hdf":\(.*\): \
+	   \(.*\)/\3\_\4\_h\5\_\8\_250m_16_days_NDVI.tif/')
+done
+\end{smallverbatim}
+
+\section{Importing in GRASS}
+Once your files are prepared, they can be imported in GRASS.
+
+\begin{smallverbatim}
+cd $rootNDVI
+for file in $rootNDVI
+do
+	r.in.gdal input=$file output=$file
+done
+\end{smallverbatim}
+
+To access blindly an NDVI set of files, create a variable list from g.mlist:
+\begin{smallverbatim}
+listNDVI=$(g.mlist type=rast pattern=*NDVI*)
+echo $listNDVI
+\end{smallverbatim}
+
+\section{QA Flags screening}
+Use the \textit{i.modis.qc} module.
+
+\begin{center}
+ \includegraphics[scale=0.45]{i_modis_qc.png}
+\end{center}
+
+\address{GRASS Development Team\\
+  \url{http://grass.osgeo.org}\\
+  \email{tmitchell at osgeo.org}}
+
+%%% Local Variables: 
+%%% mode: latex
+%%% TeX-master: main\_document.tex
+%%% End: 
+

Added: grass-promo/tutorials/grass_modis/grass_osgeo_logo.jpg
===================================================================
(Binary files differ)


Property changes on: grass-promo/tutorials/grass_modis/grass_osgeo_logo.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: grass-promo/tutorials/grass_modis/i_modis_qc.png
===================================================================
(Binary files differ)


Property changes on: grass-promo/tutorials/grass_modis/i_modis_qc.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: grass-promo/tutorials/grass_modis/main_document.tex
===================================================================
--- grass-promo/tutorials/grass_modis/main_document.tex	                        (rev 0)
+++ grass-promo/tutorials/grass_modis/main_document.tex	2010-12-23 00:59:00 UTC (rev 44678)
@@ -0,0 +1,43 @@
+% Main document GRASS Tutorials
+% Language: Latex
+%
+% DON'T EDIT THIS FILE!
+
+\documentclass[a4paper]{report}
+
+% for boot
+\usepackage{amssymb}
+% Note: we currently need to include amsmath before GRASSnews, because the
+% latter redefines the equation environment ...
+\usepackage{GRASSnews}
+\usepackage[round]{natbib}
+% for Sweave
+\usepackage{listings}
+% for tcltk-update
+\usepackage{shortvrb}
+%\usepackage{chapterbib}
+
+
+\sloppy{}
+
+
+\begin{document}
+ 
+\volume{1}
+\volnumber{1}
+\date{December 2010}
+\titlepage
+
+
+
+\begin{article}
+   \input{article_GIPE}
+\end{article}
+
+
+\end{document}
+
+%%% Local Variables: 
+%%% mode: latex
+%%% TeX-master: main_document.tex
+%%% End: 



More information about the grass-commit mailing list