Ocean Color Forum - Not logged in
Forum Ocean Color Home Help Search Login
Previous Next Up Topic SeaDAS / SeaDAS 6.x - General Questions / Processing MODIS high resolution data from L0 to L3 binni (locked) (4018 hits)
By ndungu Date 2011-10-22 22:18 Edited 2011-10-24 13:22
Am new in Seadas and linux commands. I would like to processes Modis 250m resolution data on chlorophyll-a. I went through the forum to see whether I can make a script that can run through a batch from L0 to L3 binning for my area of interest. I have downloaded .PDS bz2 data for this work. Please show me how to start off in modifying the script below to suit my purpose.

#!/bin/csh -f

foreach ifile (*.PDS)
  set geofile = `echo $ifile | sed "s/L1A_LAC/GEO/g"`
  set l1bfile = `echo $ifile | sed "s/L1A_LAC/L1B_LAC/g"`
  set l2file = `echo $ifile | sed "s/L1A_LAC/L2_LAC/g"`
  $SEADAS/etc/l1agen_modis
  $SEADAS/etc/modis_L1A_to_GEO.csh $l1afile
  $SEADAS/etc/modis_L1A_to_L1B.csh $l1afile $geofile
  $SEADAS/run/bin/l2gen
  msl12 ifile=$l1bfile geofile=$geofile ofile=$l2file l2prod="chl_oc2,chl_oc3,chl_oc4,chlor_a,pig_oc2,pig_oc3,pig_oc4,l2_flags,K_490,water_vapor,chl_gsm01"
end

By gwyn Date 2011-10-28 15:05
IIRC, you're using SeaDASv6.2b, so I'm a bit puzzled about your paths.

Not sure what you mean by pig_oc2,pig_oc3,pig_oc4.  Enter "$SEADAS/run/bin/l2gen" to see all the available options.

I'd do something like this:


#!/bin/csh -f
set l2prod = "chl_oc2,chl_oc3,chlor_a,l2_flags,K_490,water_vapor,chl_gsm01"
foreach l0file (*.PDS)

  # generate L1A file
  $SEADAS/run/scripts/modis_L1A.csh $l0file

  # find filenames
  set l1afile = `ls -1t *.L1A_LAC | head -1`
  set gran = `echo $l1afile | sed 's/\.L1A_LAC$//'`
  set geofile = $gran.GEO
  set l1bfile = $gran.L1B_LAC
  set l2file = $gran.L2_LAC

  # generate GEO & L1B files
  $SEADAS/run/scripts/modis_GEO.csh $l1afile -o $geofile -b
  $SEADAS/run/scripts/modis_L1B.csh $l1afile    $geofile -b

  # generate L2 file
  $SEADAS/run/bin/l2gen ifile=$l1bfile geofile=$geofile ofile=$l2file l2prod=\"$l2prod\"

end
By ndungu Date 2011-10-29 05:50
Gwyn,

Thank you Gwyn. I made an executable file using your suggestion but I it fails and I can't figure out the reason for its failure. I read one post which says that from oct 2010 the level 1 data downloaded directly can give high resolution modis Aqua and therefore I thought of trying it as well. However, after uncompressing the filles, the files end with *L1A_LAC.x.hdf. when I run my script, I get a message indicating that hdf files are not supported. please advise me on the which the way to go. Is it from L0 or L1A_LAC.x.hdf?

seadas@seadas-vm:~/Jan2011/MOD00.P2011001.1325_1.PDS$ chmod u+x batchprocess.txt
seadas@seadas-vm:~/Jan2011/MOD00.P2011001.1325_1.PDS$ ./batchprocess.txt
Determining pass start and stop times...
/disk01/seadas/seadas/run/bin/l0cnst_write_modis MOD00.P2011001.1325_1_1.PDS
modis_L1A.csh: A corrupt packet or a packet of the wrong size
        was detected while generating the constructor file.
Attempting to fix the Level 0 file using l0fix_modis...
/disk01/seadas/seadas/run/bin/l0fix_modis MOD00.P2011001.1325_1_1.PDS -1 -1
/disk01/seadas/seadas/run/bin/l0fix_modis MOD00.P2011001.1325_1_1.PDS 568041907.088639 568042025.659607 MOD00.P2011001.1325_1_1.PDS.fixed
New Level 0 file successfully generated. Regenerating constructor file...
/disk01/seadas/seadas/run/bin/l0cnst_write_modis MOD00.P2011001.1325_1_1.PDS.fixed

multiple: 1 * 10
multiple: -1 * 10
Input  Level 0 : ./MOD00.P2011001.1325_1_1.PDS.fixed
Output Level 1A: ./A2011001132510.L1A_LAC

Satellite: aqua
starttime: 2011-01-01T13:25:10.088639Z
stoptime:  2011-01-01T13:26:48.659607Z
duration:  98.570968 seconds

Processing MODIS L0 file to L1A...
/disk01/seadas/seadas/run/bin/l1agen_modis
L1A version: 5.0.5  built on Apr  7 2011 (14:39:32)
Scan Number: 0  Sat Oct 29 01:21:26 2011
Scan Number: 10  Sat Oct 29 01:21:32 2011
Scan Number: 20  Sat Oct 29 01:21:37 2011
Scan Number: 30  Sat Oct 29 01:21:40 2011
Scan Number: 40  Sat Oct 29 01:21:45 2011
Scan Number: 50  Sat Oct 29 01:21:47 2011
Scan Number: 60  Sat Oct 29 01:21:50 2011
l1agen_modis exit status: 0
MODIS L1A processing complete.

Determining required attitude and ephemeris files...
modis_atteph.py ./A2011001132510.L1A_LAC
Input  Level 1A   : ./A2011001132510.L1A_LAC
Output Geolocation: ./A2011001132510.GEO

Satellite: aqua
Year: 2011  Day: 001  Hour: 13  Minute: 25
*Terrain Correction Enabled*

Creating MODIS geolocation file...
/disk01/seadas/seadas/run/bin/geogen_modis
GEO version: 5.0.14 built on Apr  7 2011 (14:39:53)
geogen_modis exit status: 1

Running validation test on geolocation file...
modis_geocheck.py A2011001132510.GEO 95 --verbose
*** ERROR: Provided geolocation file does not exist.
*** Validation test failed for geolocation file: A2011001132510.GEO

modis_GEO.csh: ERROR: MODIS geolocation processing failed.
Please ensure utcpole.dat and leapsec.dat are up-to-date in
/disk01/seadas/seadas/run/var/modis
Please examine the LogStatus and LogUser files for more information.

modis_L1B.csh: ERROR: File ./A2011001132510.GEO does not exist.

Usage: modis_L1B.csh MODIS_L1A_file MODIS_GEO_file [OPTIONS]

Options:

  -b                        Use base of input filename for output filenames
                            (without -b, output filenames are automatically determined)
  -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 processing log file(s)

-E- getformat.c: Input file 'A2011001132510.L1B_LAC' does not exist or cannot open.
-E- msl12_input.c Line 836: Could not find type for file A2011001132510.L1B_LAC.
-E- msl12_input.c: Error reading program options.
-E- /disk01/seadas/seadas/run/bin/l2gen: Error parsing input parameters.
Determining pass start and stop times...
/disk01/seadas/seadas/run/bin/l0cnst_write_modis MOD00.P2011001.1325_1.PDS
modis_L1A.csh: A corrupt packet or a packet of the wrong size
        was detected while generating the constructor file.
Attempting to fix the Level 0 file using l0fix_modis...
/disk01/seadas/seadas/run/bin/l0fix_modis MOD00.P2011001.1325_1.PDS -1 -1
/disk01/seadas/seadas/run/bin/l0fix_modis MOD00.P2011001.1325_1.PDS 568041907.088639 568042025.659607 MOD00.P2011001.1325_1.PDS.fixed
New Level 0 file successfully generated. Regenerating constructor file...
/disk01/seadas/seadas/run/bin/l0cnst_write_modis MOD00.P2011001.1325_1.PDS.fixed

multiple: 1 * 10
multiple: -1 * 10
Input  Level 0 : ./MOD00.P2011001.1325_1.PDS.fixed
Output Level 1A: ./A2011001132510.L1A_LAC

Satellite: aqua
starttime: 2011-01-01T13:25:10.088639Z
stoptime:  2011-01-01T13:26:48.659607Z
duration:  98.570968 seconds

Processing MODIS L0 file to L1A...
/disk01/seadas/seadas/run/bin/l1agen_modis
L1A version: 5.0.5  built on Apr  7 2011 (14:39:32)
Scan Number: 0  Sat Oct 29 01:22:23 2011
Scan Number: 10  Sat Oct 29 01:22:32 2011
Scan Number: 20  Sat Oct 29 01:22:33 2011
Scan Number: 30  Sat Oct 29 01:22:37 2011
Scan Number: 40  Sat Oct 29 01:22:39 2011
Scan Number: 50  Sat Oct 29 01:22:42 2011
Scan Number: 60  Sat Oct 29 01:22:47 2011
l1agen_modis exit status: 0
MODIS L1A processing complete.

Determining required attitude and ephemeris files...
modis_atteph.py ./A2011001132510.L1A_LAC
Input  Level 1A   : ./A2011001132510.L1A_LAC
Output Geolocation: ./A2011001132510.GEO

Satellite: aqua
Year: 2011  Day: 001  Hour: 13  Minute: 25
*Terrain Correction Enabled*

Creating MODIS geolocation file...
/disk01/seadas/seadas/run/bin/geogen_modis
GEO version: 5.0.14 built on Apr  7 2011 (14:39:53)
geogen_modis exit status: 1

Running validation test on geolocation file...
modis_geocheck.py A2011001132510.GEO 95 --verbose
*** ERROR: Provided geolocation file does not exist.
*** Validation test failed for geolocation file: A2011001132510.GEO

modis_GEO.csh: ERROR: MODIS geolocation processing failed.
Please ensure utcpole.dat and leapsec.dat are up-to-date in
/disk01/seadas/seadas/run/var/modis
Please examine the LogStatus and LogUser files for more information.

modis_L1B.csh: ERROR: File ./A2011001132510.GEO does not exist.

Usage: modis_L1B.csh MODIS_L1A_file MODIS_GEO_file [OPTIONS]

Options:

  -b                        Use base of input filename for output filenames
                            (without -b, output filenames are automatically determined)
  -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 processing log file(s)

-E- getformat.c: Input file 'A2011001132510.L1B_LAC' does not exist or cannot open.
-E- msl12_input.c Line 836: Could not find type for file A2011001132510.L1B_LAC.
-E- msl12_input.c: Error reading program options.
-E- /disk01/seadas/seadas/run/bin/l2gen: Error parsing input parameters.
seadas@seadas-vm:~/Jan2011/MOD00.P2011001.1325_1.PDS$

Jane
By gwyn Date 2011-10-31 13:27
Jane,

Level 0: raw spacecraft data (aka PDS)
Level 1A: raw data formatted for easier access to sensor data numbers (DNs)
Geolocation:  positional info, incl. lat/lon, solar angles
Level 1B: sensor data converted to radiance or reflectance
Level 2: derived geophysical parameters (e.g. chl) for a granule
Level 3: geophysical parameters aggregated to longer timescale & larger area

You can start with either L0 or L1A - but if you start with L0 you have to convert to L1A anyway.

You should make sure each step works before putting them all into a loop.  You might consider using the SeaDAS GUI to step through the process before using a command-line script.

In this case, it looks like l1agen_modis (modis_L1A.csh) ran fine, but geogen_modis (modis_GEO.csh) failed.  A clue:

modis_GEO.csh: ERROR: MODIS geolocation processing failed.
Please ensure utcpole.dat and leapsec.dat are up-to-date in
/disk01/seadas/seadas/run/var/modis
Please examine the LogStatus and LogUser files for more information.


You should run modis_update_utcpole_leapsec.csh to update the utcpole.dat and leapsec.dat.
If you still get the error look at the LogStatus and LogUser files left behind in the processing directory.
By ndungu Date 2011-12-01 06:59
Dear Gywn,

I have been struggling for one month to process the chlo-a using the graphic user interface before applying the loop invain. The processing is succcessfully done but the image contains a single value for my study area.
   Northernmost Latitude:      -0.564318
   Southernmost Latitude:      -1.04187
   Westernnmost Longitude:     36.1651
   Easternnmost Longitude:     36.5261

What adjustment should I do to get spatial variability? Please help.

Jane
By gwyn Date 2011-12-01 14:33
Hi, Jane -

How many granules are you using?  Any one granule might not show chlorophyll if the area was cloudy.

Is your goal to get higher-resolution time-averaged chl-a in Lake Naivasha?  You might want to start with one of our standard L3 products, which are at 4.6x4.6km resolution and come binned to various time resolutions.  Start with the Level 3 Browser to get an idea of what products are available, then either use the file search page or go directly to the archive to get sample data.

Once you are sure of which product you want, see links from this post for guidance on how to process to higher resolution.  You should be aware that some of the info in the links is outdated; for instance, hi-res data is now included in L1A files.
By ndungu Date 2011-12-01 17:14
Dear Gywn,

I intend to first process the 8-day 250m averaged chlo-a for lake Naivasha. I went through the L3 products and it seems like the lake is masked as land because even the yearly composite shows no data. How can one overcome this?

Jane
By gwyn Date 2011-12-01 18:04 Edited 2011-12-01 19:19
I see what you mean!  You can use the proc_land keyword for l2gen:

$SEADAS/run/bin/l2gen ifile=$l1bfile geofile=$geofile ofile=$l2file l2prod=\"$l2prod\" resolution=500 proc_land=1

You can try using resolution=250 but I doubt you'd get any improvement since the highest-resolution MODIS bands used for calculating chlorophyll are 500m.  Lake Naivasha is at most 12km long, so most 500m pixels will include land at the shoreline.
By ndungu Date 2011-12-02 16:12 Edited 2011-12-02 23:30
Dear Gwyn,

several attempts of the "proc_land =1" gives no data for all the inland waters. what could be the problem?

Jane
Previous Next Up Topic SeaDAS / SeaDAS 6.x - General Questions / Processing MODIS high resolution data from L0 to L3 binni (locked) (4018 hits)



Responsible NASA Official: Gene C. Feldman
Curator: OceanColor Webmaster
Authorized by: Gene C. Feldman
Updated: 27 November 2007
Privacy Policy and Important Notices NASA logo