Hi Kim,
The procedures I use to make the images that you may have seen vary a bit depending
on the scene in question, but there are some general similarities. I'll share some of
the process that went into making the
current feature image in case that helps.
The following bash script makes use of code from
SeaDAS, the
HDFGroup,
GMT,
ImageMagick,
pfstools, and
Perl, plus some that I wrote myself which I will
attach to this message. I will link to program descriptions where I can.
update_luts.py aqua
for f in A2017245125500; do
wget https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/$f.L1A_LAC.bz2
bunzip2 $f.L1A_LAC.bz2
modis_GEO.py $f.L1A_LAC
getanc.py $f.L1A_LAC
modis_L1B.py $f.L1A_LAC $f.GEO
l2gen ifile=$f.L1B_LAC geofile=$f.GEO ofile=$f.L2_rhos_645 l2prod=rhos_645 resolution=250
l2gen ifile=$f.L1B_LAC geofile=$f.GEO ofile=$f.L2_rhos_469_555_645 l2prod=rhos_469,rhos_555,rhos_645 resolution=500
# Extract the pertinent data from the level-2 files.
h5dump -d /geophysical_data/rhos_645 -b -o nak $f.L2_rhos_645
cat nak >>rhos_645_q
h5dump -d /navigation_data/latitude -b -o nak $f.L2_rhos_645
cat nak >>lat
h5dump -d /navigation_data/longitude -b -o nak $f.L2_rhos_645
cat nak >>lon
h5dump -d /geophysical_data/rhos_469 -b -o nak $f.L2_rhos_469_555_645
cat nak >>rhos_469_h
h5dump -d /geophysical_data/rhos_555 -b -o nak $f.L2_rhos_469_555_645
cat nak >>rhos_555_h
h5dump -d /geophysical_data/rhos_645 -b -o nak $f.L2_rhos_469_555_645
cat nak >>rhos_645_h
done
rm nak
# Interpolate the 500-meter bands to 250-meter.
~/tools/bilinearmodis h q z rhos_469_h > rhos_469_hq
~/tools/bilinearmodis h q z rhos_555_h > rhos_555_hq
~/tools/bilinearmodis h q z rhos_645_h > rhos_645_hq
# Sharpen the blue and green bands using the red band as follows.
# Divide the interpolated blue (green) band by the quotient of the
# interpolated-250-meter red band over the native-250-meter red band.
# If either the native or interpolated red value is 0,
# then use a quotient of 1.
gmt math -bi1f -bo1f rhos_469_hq rhos_645_hq DUP rhos_645_q DUP 3 1 ROLL MUL 3 1 ROLL DIV 1 IFELSE DIV = rhos_469_q
gmt math -bi1f -bo1f rhos_555_hq rhos_645_hq DUP rhos_645_q DUP 3 1 ROLL MUL 3 1 ROLL DIV 1 IFELSE DIV = rhos_555_q
# Map the data.
f=A2017245125500
for i in rhos_???_q; do
perl -e 'open X,"lon" or die;open Y,"lat" or die;open Z,"'$i'" or die;while(read(Z,$z,4)){read(X,$x,4);read(Y,$y,4);print $x,$y,$z}' | gmt mapproject -bi3f -bo3f -R3/-39/22/-23r -Jb13/-30/-34/-26/1:800000 | gmt nearneighbor -G$i.grd -I0.01 -N4 -R0/88.62/0/87.3 -S0.04 -r -bi3f -V
gmt grdmath $i.grd 0.008 MAX 0.008 DIV LOG 2 0.008 DIV LOG DIV 1 MIN 65535 MUL = nak.grd
gmt grd2xyz nak.grd -ZTLHw > nak.dat
echo -e "P5\n8862 8730\n65535"|cat - nak.dat>$i.16bit.log.pgm
done
convert rhos_645_q.16bit.log.pgm rhos_555_q.16bit.log.pgm rhos_469_q.16bit.log.pgm -combine $f.rhos_645_555_469.log.tif
convert $f.rhos_645_555_469.log.tif -separate \( -clone 0 -equalize \) \( -clone 1 -equalize \) \( -clone 2 -equalize \) -delete 0-2 -combine $f.rhos_645_555_469.log.eq.png
pfsin $f.rhos_645_555_469.log.tif |pfstmo_fattal02 | pfsgamma 2.2| pfsout $f.rhos_645_555_469.log.fattal.png
pfsin $f.rhos_645_555_469.log.tif |pfstmo_mantiuk06 -e 0.5|pfsgamma 2.2|pfsout $f.rhos_645_555_469.log.mantiuk.png
# Make a chlorophyll map.
wget https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/$f.L2_LAC_OC.nc
h5dump -d /geophysical_data/chlor_a -b -o chl A2017245125500.L2_LAC_OC.nc
h5dump -d /navigation_data/latitude -b -o lat A2017245125500.L2_LAC_OC.nc
h5dump -d /navigation_data/longitude -b -o lon A2017245125500.L2_LAC_OC.nc
perl -e 'open X,"lon" or die;open Y,"lat" or die;open Z,"chl" or die;$nd=pack "f",-32767;while(read(Z,$z,4)){read(X,$x,4);read(Y,$y,4);next if $z eq $nd;print $x,$y,$z}' | gmt mapproject -bi3f -bo3f -R3/-39/22/-23r -Jb13/-30/-34/-26/1:800000 | gmt nearneighbor -Gchl.grd -I0.01 -N4 -R0/88.62/0/87.3 -S0.12 -r -bi3f -V
gmt grdmath chl.grd 0.04 MAX 0.04 DIV LOG 20 0.04 DIV LOG DIV 1 MIN 65535 MUL = nak.grd
gmt grd2xyz nak.grd -ZTLHw > nak.dat
echo -e "P5\n8862 8730\n65535"|cat - nak.dat>chl.16bit.log.pgm
convert chl.16bit.log.pgm -fill gray -opaque black nak.tif
pfsin nak.tif|pfstmo_fattal02|pfsgamma 2.2|pfsout chl.fattal.png
pfsin nak.tif|pfstmo_mantiuk06 -e 0.5|pfsgamma 2.2|pfsout chl.mantiuk.png
So much for the semi-automated bulk of the work. What I do next is load
the image layers I created above into my favorite image processing program,
the Gimp. (You could also use any image software that can handle layers
such as Photoshop. I just have become familiar with Gimp which has the
added advantage of being free.) At this point it becomes harder to write
down a description since every image requires different blending techniques.
If you get this far, I would suggest that you experiment with different blending
operators to merge the layers. The blending modes I use most often in Gimp are
overlay/soft light, screen, multiply, value, grain merge, and color. I also make
liberal use of layer masks to control which portions of which layers get blended in.
It is also possible, of course, to
blend layers in a non-interactive way using programs
such as those in the aforementioned ImageMagick suite, but it's much harder
to tailor blends to individual scenes without seeing how each layer affects the
result as it is being applied.
I hope you find this helpful.
Regards,
Norman
P.S.
One of my biggest challenges when working up images like these is sun glint
which obscures ocean color and accentuates sensor striping artifacts. I would
be very pleased to have a sensor, like the ocean-color imager on the proposed
PACE mission, that tilts to avoid sun glint and avoids striping with a single-string
detector design.
attachment 1