User:Supportstorm/sandbox

MODIS is a NASA scientific satellite which is especially useful for it's high resolution and natural colored images. In this tutorial we will be using a set-up configured to Windows user using Cygwin.

Technical Details
NASA has released most of it's MODIS products for the general public, free of cost. The data is packed in HDF files which takes specialized programs to read its properties. In this tutorial, however we will be focused on extracting natural colored images from these HDF files.

There are three HDF files that are captured in every subset of it's polar swath. The first file is the 1KM file which contains the thermal and natural color data which is used in the higher resolution files. As the name suggest the file is 1 kilometer in resolution and as such will produce a 1 km image. The second file is the HKM HDF file. It is 500 meters in resolution. The last file is the QKM HDF file which produces a 250 meter resolution image. You need all three files in order to make a 250m resolution image. Each file takes up more than 150 MB in space, so you will need to make a lot of space for these files. You might need to delete the files after you are done using them to conserve space.

Installation
We will be using this link as a guideline when installing and using the Cygwin commands.

1. You will need to install Cygwin. Download the setup.exe provided by Cygwin's home page. Follow the installation process. When you get to the select packages option locate the X11 and click on it to switch the install and click next. This should automatically install Cygwin onto your computer.

2. Once you have Cygwin installed to your computer go to your desktop and open the Cygwin Terminal. From the command box type This should open up the Cygwin Extreme program.

3. Go to HDFLook web page and download the CYGWIN_INTEL_HDFLook.tar.gz and MAPS.tar.gz files. Un-zip the folders and place them in your Cygwin home folder. This should be the location:C:\cygwin\home\username.

4. Type the following commands exactly as follows in your Cygwin Extreme box: This will allow you to access the Java based version of HDFLook, but you will need to type this in every time you start the program.

5. Ok, now is time to download the HDF files. You can access them from the MODIS Near Real Time (Orbit Swath) Images, which is easier to view the image, or if you already know the HDF file name you can download directly from the archive here. Note: You might need to register with NASA's EOSDIS to access the archive. In the archive TERRA data is linked to MOD1KM (1KM HDF file), MODHKM (500m), and MODQKM (250m). Aqua data is linked to MYD1KM (1KM HDF file), MYDHKM (500m), and MYDQKM (250m). Open up the three links and select the year, date, and time and download the HDF file. Once you have downloaded the files place them in your Cygwin home directory mentioned above.

6. Go to the Cygwin Extreme console and to the HDFLook program press the $home button. This should refresh the program. Scroll down and locate the QKM HDF file and click it. This should open the file option box. Now at the top there is a list of SDS configurations. Select the EV_250m_RefSB. Choose the Set RGB enhance value option and put in the following settings: Please note that this is the color sequence that I use on images and is in no means the best way to color correct the image. If you do not like the result when you are finish you can experiment with those setting for color and brightness.
 * Red (5.5, 9.5)
 * Green (5.6, 9.5)
 * Blue (5.7, 9.5)

Set the pixel interpolation on and set the projection to linear.

Set the predefined scaling to reflectance.

You are done setting file properties. Go to dump data, create RGB image, and select create Geotiff. A box will appear asking to input file name and path. Fill that in and copy the red numbers into the resolution boxes. (Note some images are too large and will result in an error. In those instances please select a width below 16000 px or a generally smaller size.) This will launch the system to create the image which could take a few minutes.

7. Now after you created the image you will need to clean it up using an image manipulating software like Photoshop or gimp. Noise will be present in the image, for reason I'm not fully aware of. The color of the noise is a yellow-green (dcde00), a light blue (00e3e6), and a deep purple (df00e4). To remove the noise go to the replace color feature in your software and use the teardrop tool on the noise pixel. Completely de-saturate and set the brightness to match surrounding pixels. Repeat with the other noise pixels. After this you will need to color correct the clouds or water. Clouds should be a very slight yellow/red and water will probably need to be de-saturated. Sharpen last and export as a JPG at maximum quality.

Merging Images
To merge subsets you will need to download Quantum GIS. Once downloaded go to the raster icon> miscellaneous> merge. Input the Geotiff images and simply merge them. From there you can work on it in an image manipulating software.