FWTOOLS: Install and test

The next set of tools we will want to get are FWTools.  FWTools provides access to gdal utilities and OpenEv  which I’ll be demonstrating here. There is another source for gdal that provides more upto date versions of gdal and which has the support of the maintainer of FWTools. That is OSgeo4w.  Going forward I’ll see if the MODIS R package can support  the OSgeo4w pathway forward.

UPDATE: look like MODIS will be supporting OSGeo4w as a primary source of gdal.  You can continue to use FWTools, if you like, but OSGeo4w is going to have the latest versions of Gdal for windows and that is what the MODIS package wants to use.  You can continue with the tutorial on FWTools if you like to see how a GDAL command works, or you can just go install gdal using OSGeo4w in the next step. 

Go get FWTools.   The windows Binaries are  here.   I just download to my desktop and then install.  The install happens in the Program Files (x86) directory.  You should also read this.  When you finish the install you will have a couple of desktop icons.  One for FWTools Shell and the other for OpenEnv. Click on FWTools Shell.

The batch files within FWTools will configure your paths and directories so that commands will work from this location. If you want to add FWtools to your permament path you will have to edit the path variable I showed in step 2.  It’s fairly narly, so I don’t do that. If you want to please consult the bat files   setfw.bat  which is in the main directory and  setfwenv.bat which is in the “bin” directory. This gets called by “setfw.bat”  and the enviroment variables are set for your session. It involves more than setting one path. ( maybe I’ll do this later )

For now, test our install of FWTools.   At the prompt  enter the command  gdalinfo  C:\\Test\\MOD11A2.A2006185.h10v04.005.2008134190545.hdf

Now, I had my test directory set up on G so my command looked like this:

If your tools are working you should see a display that looks like this:

That is basically a dump of all the information or metadata about the multiple files that are in this HDF.  You should also research the HDF format.  If you scroll up and down in that display you should see “subdatasets”  These are the various datasets within the HDF file.  The names are important because if you want to run a different  gdal command  like gdal_translate  you have to specify the subdataset name. Not knowing that fact cost me countless hours of keyboard slamming and web searches.  Those names look like what you see below. Note that for this particular test I shorted the name of my MODIS file  to  “o.hdf” ( can you say annoyed about long file names!! )

As you can see working with these command line tools can be a pain in the ass, but in the end we will construct scripts to do all the processing from R. That is, we will be calling these functions using the system() command in R.  If you are not hung up about calling everything from R then you can just use these tools manually to transform everything from the HDF format to more common formats.

One last bit we will look at is  OpenEV.  Click on that Icon.

Then open the hdf file

Under tools pick a reprojection:  I reprojected to geostationary satillite with a WGS84 datum and saved as a GeoTiff.  After processing I load that file up and it should look like this

If you’ve followed all those steps and installed properly then The next steps will involve  get the MODIS R package.

UPDATE:  you should use OSGeo4w to get the latest version of GDAL for windows

Next Step is here

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: