The forum is locked.

The Ocean Color Forum has transitioned over to the Earthdata Forum (https://forum.earthdata.nasa.gov/). The information existing below will be retained for historical reference. Please sign into the Earthdata Forum for active user support.

Up Topic Frequently Asked Questions / Data Products & Algorithms FAQ / How do I make true-color images from MODIS or SeaWiFS (locked)
- By bryanfranz Date 2006-05-01 17:32 Edited 2010-07-12 13:44
The following assumes you have SeaDAS installed and the seadas environment
sourced, so that the distributed binaries are visible from the UNIX
commandline. If so, the following steps will enable the generation of
true-color (RGB) images from and L1A product distributed from the ocean color
web. It should also work for MODIS direct broadcast files if processed to
standard L1A via SeaDAS or MODISL1DB.  The process described here uses
l1brsgen, and produces images in sensor coordinates (not mapped).  For mapped
images, a related binary - l1mapgen -  is also provided with SeaDAS.  The
steps are:

1) make GEO file (MODIS only)
2) make L1B file (MODIS only)
3) make true-color PPM file
4) convert PPM to JPEG (optional)

This can all be done from the unix commandline.  You don't need to actually run seadas.  Here's an example:

% modis_L1A_to_GEO.csh A2003080085000.L1A_LAC
% modis_L1A_to_L1B.csh A2003080085000.L1A_LAC A2003080085000.GEO
% l1brsgen ifile=A2003080085000.L1B_LAC geofile=A2003080085000.GEO ofile=A2003080085000.ppm subsamp=4 outmode=2 atmocor=1
% cjpeg A2003080085000.ppm > A2003080085000.jpg

In step 3,  outmode=2 is used to specify ppm output, subsamp=4 to specify sub-sampling every 4th pixel and line,
atmocor=1 to specify performing a partial atmospheric correction to remove Rayleigh and diffuse transittance effects. 
For SeaWiFs, OCTS, or CZCS, steps 1 and 2 are not required, as the l1brsgen code (like l2gen) can read the
L1A directly. Here is the full usage message of the programs required:

1) Usage: modis_L1A_to_GEO.csh MODIS_L1A_file [OPTIONS]

Options:

  -o GEO_file               Output MODIS GEO HDF filename
  -a1 attitude_file1        Input attitude file 1 (chronological)
  -a2 attitude_file2        Input attitude file 2 (chronological)
  -e1 ephemeris_file1       Input ephemeris file 1 (chronological)
  -e2 ephemeris_file2       Input ephemeris file 2 (chronological)
  -disable-definitive       Disable use of definitive attitude/ephemeris
  -disable-definitive-ftp   Disable auto-downloading of definitive attitude/ephemeris
  -disable-predicted        Disable use of real-time attitude/ephemeris
  -disable-predicted-ftp    Disable auto-downloading of real-time attitude/ephemeris
  -disable-utcpole_leapsec  Disable auto-downloading of utcpole.dat and leapsec.dat
  -verbose-ftp              Enable verbose auto-download messages
  -disable-dem              Disable terrain elevation correction
  -geocheck_threshold n     % of geo-populated pixels required to pass geocheck validation test
  -save-log                 Save the geolocation processing log file

2) Usage: modis_L1A_to_L1B.csh L1A_file GEO_file [OPTIONS]

Options:

  -o L1B_1KM_filename       Output MODIS L1B 1KM HDF filename
  -h L1B_HKM_filename       Output MODIS L1B HKM HDF filename
  -q L1B_QKM_filename       Output MODIS L1B QKM HDF filename
  -rlut REFL_LUT_filepath   Full path and filename of Reflective LUT file
  -elut EMIS_LUT_filepath   Full path and filename of Emissive LUT file
  -qlut QA_LUT_filepath     Full path and filename of QA LUT file
  -delete-1km               Delete 1km resolution L1B file
  -delete-hkm               Delete 500m resolution L1B file
  -delete-qkm               Delete 250m resolution L1B file
  -save-log                 Save the Level 1B processing log file

3) l1brsgen 6.3.3 (Jul  2 2010 22:17:53)
Usage: l1brsgen argument-list

The argument-list is a set of keyword=value pairs. The arguments can
be specified on the commandline, or put into a parameter file, or the
two methods can be used together, with commandline over-riding.

The list of valid keywords follows:

   par=input parameter file

   ifile=input L1 file name
   geofile=input L1 geolocation file name (MODIS only)
   ofile=output file name

   spixl=start pixel number (default=1)
   epixl=end pixel number (default=the last pixel)
   sline=start line number (default=1)
   eline=end line number (default=the last line)
   subsamp=subsampling interval (default=10)
   resolution=define the processing resolution (MODIS only)
       -1: standard ocean 1km processing, limited band set
     1000: 1km resolution including aggregated 250 and 500m land bands.
      500: 500m resolution including aggregated 250 land bands and replication
          for lower resolution bands.
      250: 250m resolution with replication for lower resolution bands.

   outmode=defines output format (default=0)
       0 = 8bit HDF
       1 = 24bit HDF
       2 = PPM (portable pixmap)
       3 = flat binary

   rgb=bands to use for red, green and blue (default=sensor specific)
   atmocor=use surface reflectance (default=0, use top of atmosphere reflectance)
   datamin=minumum reflectance for scaling (default=0.01)
   datamax=minimum reflectance for scaling (default=0.9)
   stype=set scaling type (default=0)
       0 = log scaled between datamin and datmax
       1 = linearly scaled between datamin and datmax

The default band combination produces a "true-color" image
Other combinations may be chosen with the "rgb=" option.  The expected
argument to this option is a comma separated string of wavelengths that specifies
the desired bands in red-green-blue order.  For example, to produce a false
color SeaWiFS output image using 865, 670 and 555 nm
as the red, green, and blue values respectively, the option would be specified
as "rgb=865,670,555".

4) For conversion from ppm to jpeg, you can use the freely available cjpeg.

  http://linuxcommand.org/man_pages/cjpeg1.html
Up Topic Frequently Asked Questions / Data Products & Algorithms FAQ / How do I make true-color images from MODIS or SeaWiFS (locked)