[GRASSLIST:5591] Re: r.in.hdf

Dear Dr. Neteler, Bartholdy, and GRASS users:

Thank you for giving me advices on r.in.hdf. Following Dr. Neteler's suggestion,
I tried r.in.gdal instead of r.in.hdf.

First, I downloaded the latest GDAL package from
ftp://ftp.remotesensing.org/pub/gdal/openev/openev_FW_linux_1.5.4.tar.gz
and installed it to /usr/local/open_FW/. Then I compiled grass5.0.1 with
  $ ./configure --with-gdal=/usr/local/openev_FW/ --without-odbc --without-fftw --without-postgres
  $ make
  # make install
But r.in.gdal returned an error message when I run it. Then I added a path to the GDAL library:
  GRASS> export LD_LIBRARY_PATH=/usr/local/grass5/lib:/usr/local/openev_FW/lib
This was the key. Then I successfully imported SPOT-Vegetation HDF data with r.in.gdal.
It's really nice.

But I do not see why GRASS did not set LD_LIBRARY_PATH automatically for GDAL.
Anyway, I added this export command to /usr/local/bin/grass5, hence I do not have to care
about it any more. But if anybody know why this happened, I would like to ask.

As for MODIS, I know MODIS-Reprojection-Tool (MRT) is the best choice for such a
beginner like me, but as far as I tried, MRT runs only under GUI of Java. I wondered whether
there might have been another choice which can provide batch (script) processing for lots of
MODIS HDF files at one time.

Kenlo Nishida

----- Original Message -----
From: "Markus Neteler" <neteler@itc.it>
To: <nishida@bres.tsukuba.ac.jp>
Cc: <grasslist@baylor.edu>
Sent: Monday, February 17, 2003 10:38 PM
Subject: [GRASSLIST:5583] Re: r.in.hdf

On Sun, Feb 16, 2003 at 03:45:27PM +0900, nishida@bres.tsukuba.ac.jp wrote:
> Dear GRASS users:
>
> I would like to ask your help.
> I have troubles using r.in.hdf in GRASS5.0.1 and GRASS4.3
> on Linux on my intel-PC.
>
> On GRASS5.0.1 I found r.in.hdf had not been installed,
> hence I tried to install it by myself by running "# gmake5"
> under ~/grass5.0.1/src.garden/grass.hdf/ but I came up with
> some error messages like this:
>
> No rule to make target "-lgis" which is necessary for
> ~/grass5.0.1/dist.i686-pc-linux-gnu/etc/bin/cmd/r.in.hdf.
> Stopped.
>
> (To tell the truth, this may not be very accurate because I
> translated it from the original error message in Japanese
> in my Linux system).

Yes, the r.in.hdf is not compiled as it is not yet completely
updated. It works more or less, but I have no time to finish it.

The recommendation is to use r.in.gdal instead. GDAL supports
HDF from the current official release onwards.

> On GRASS4.3, I downloaded a precompiled binary and found that
> r.in.hdf was one of default commands already compiled in the
> binary. I tried to use it for two HDF files: a SPOT-Vegetation
> radiometric data as well as MODIS data (MOD02QKM), but in both
> case, I came up with messages as follows and obtained no data in
> raster data lists at g.list.

The old r.in.hdf from GRASS4.3 is unable to read recent HDF files.

> Large file - reading row by row.
> Writing GRASS output file: hdf.rast01
> WARNING: G_set_window(): Illegal latitude for North
>
> I know the HDF format of MODIS is not pure HDF but HDF-EOS and
> I guessed this "dialect" in HDF might caused this problem, but
> I do not know any possible problems with SPOT-Vegetation.

To process MODIS data with GRASS, you may consider to use the
MODIS reprojection tool instead of r.in.gdal as you have to
transform the ISIN projected MODIS data to something useful.
ISIN is not supported (yet) by GRASS/PROJ4 or most other GIS
systems.

To process MODIS data with GRASS, see for example:
http://mpa.itc.it/rs/
(links to MRT etc. are on that page)

Kind regards

Markus Neteler

Kenlo Nishida wrote:

But I do not see why GRASS did not set LD_LIBRARY_PATH automatically
for GDAL. Anyway, I added this export command to
/usr/local/bin/grass5, hence I do not have to care about it any
more. But if anybody know why this happened, I would like to ask.

The etc/Init.sh script adds GRASS' lib directory to LD_LIBRARY_PATH.
If you put libgdal there, no further changes are required. Also, if
you set the environment variable GDAL_HOME to the directory where
libgdal resides, that should also work.

If you put libgdal in e.g. /usr/local/lib, you have to either:

a) add /usr/local/lib to /etc/ld.so.conf (if it isn't already there),
then run "ldconfig" to update the shared library database, or

b) add /usr/local/lib to LD_LIBRARY_PATH (there are more ways to do
this than can reasonably be described here).

--
Glynn Clements <glynn.clements@virgin.net>

On Tue, Feb 18, 2003 at 08:54:14PM +0900, Kenlo Nishida wrote:

Dear Dr. Neteler, Bartholdy, and GRASS users:

Thank you for giving me advices on r.in.hdf. Following Dr. Neteler's suggestion,
I tried r.in.gdal instead of r.in.hdf.

First, I downloaded the latest GDAL package from
ftp://ftp.remotesensing.org/pub/gdal/openev/openev_FW_linux_1.5.4.tar.gz
and installed it to /usr/local/open_FW/. Then I compiled grass5.0.1 with
  $ ./configure --with-gdal=/usr/local/openev_FW/ --without-odbc --without-fftw --without-postgres
  $ make
  # make install
But r.in.gdal returned an error message when I run it. Then I added a path to the GDAL library:
  GRASS> export LD_LIBRARY_PATH=/usr/local/grass5/lib:/usr/local/openev_FW/lib
This was the key. Then I successfully imported SPOT-Vegetation HDF data with r.in.gdal.
It's really nice.

Congratulations!

Please note that the pure GDAL libs are here:
ftp://ftp.remotesensing.org/pub/gdal/
   -> files gdal*.tar.gz

[...]

As for MODIS, I know MODIS-Reprojection-Tool (MRT) is the best choice for such a
beginner like me, but as far as I tried, MRT runs only under GUI of Java. I wondered whether
there might have been another choice which can provide batch (script) processing for lots of
MODIS HDF files at one time.

The MRT also supports batch mode processing (I use it like that).
In the bin/ directory is 'resample'

MODIS Reprojection Tool v3.0a December 2002
Usage: resample -p parameter_file [options]

which reprojects a MODIS HDF file to a different format/projection
on command line.

Kind regards

Markus