Page 1 of 1

Batch processing in Seadas

Posted: Thu Aug 24, 2023 11:17 am America/New_York
by arnabp893
I am trying to crop with lat and long values and reproject multiple chlorophyl L2 files. I used my algorithm to process MODIS L1 to cholophyll L2 using Matlab. I am getting error croping and reprojecting in Matlab. I think using seadas is a better option to do that. any help is appreciated.

Re: Batch processing in Seadas

Posted: Thu Aug 24, 2023 4:01 pm America/New_York
by OB SeaDAS - xuanyang02

Re: Batch processing in Seadas

Posted: Thu Aug 24, 2023 10:03 pm America/New_York
by arnabp893
Yes. Thank you for your response.
This method is allowing me to reproject single file. Is there any other way I can reproject multiple files?

Re: Batch processing in Seadas

Posted: Fri Aug 25, 2023 12:27 pm America/New_York
by OB SeaDAS - knowles
You can use l2bin followed by l3mapgen:

1. Use l2bin to combine multiple level-2 files into a single binned file.

2. Then use l3mapgen to create a mapped file.

3. Then if l3mapgen doesn't have the projection you want then you can use the Reproject Tool on the output file of l3mapgen.

Another way would be to use l2bin followed l3mapgen for each level-2 file, which would create multiple mapped files (one for each level-2 file). Then use the Mosaic tool to combine all the mapped files into a single file.

A third way (but perhaps less advisable) is to use the Mosaic Tool directly on all the level-2 files to generate a single file. This will usually work, but the Mosaic Tool isn't optimized to directly handle a lot of level-2 files and things could break with a lot of files.

Re: Batch processing in Seadas

Posted: Fri Aug 25, 2023 12:32 pm America/New_York
by OB SeaDAS - knowles
... actually a fourth way would be to use the Reproject Tool on each level-2 file. Then use Mosaic Tool to combine all the reprojected files.

Re: Batch processing in Seadas

Posted: Fri Aug 25, 2023 12:43 pm America/New_York
by OB.DAAC - SeanBailey
Just a comment on l3mapgen - while it has a set of default projections it supports, it also accepts user defined projections...if it's available in Proj, it's (very likely) available in l3mapgen

Regards,
Sean

Re: Batch processing in Seadas

Posted: Fri Aug 25, 2023 2:45 pm America/New_York
by arnabp893
Hi Knowles,

Thanks for the response. Tried doing the first method but again l2bin takes single L2 file. So I tried using file list (l32003.txt) as this one in the ifile
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030523T194500.L2._Rrs_chl.nc
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030530T195000.L2._Rrs_chl.nc
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030601T194000.L2._Rrs_chl.nc
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030608T194500.L2._Rrs_chl.nc
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030609T185000.L2._Rrs_chl.nc
/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030617T194000.L2._Rrs_chl.nc

but that disabling the ofile. I have attached the screenshot with this comment. If there is any solution such as this one viewtopic.php?t=4378 that would be easier.

Other methods is same as manual reprojections of files and I have 100s of images.

Re: Batch processing in Seadas

Posted: Fri Aug 25, 2023 4:54 pm America/New_York
by OB SeaDAS - xuanyang02
l2bin should take a list of L2 files as ifile. If your L2 files do not have SeaDAS L2 format, l2bin might have trouble to come up with an ofile name. Can you do

Code: Select all

obpg_file_type /Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.20030523T194500.L2._Rrs_chl.nc
SeaDAS has another tool mapgen that also takes a list of files as ifile, bins them together and creates a mapped file -- https://seadas.gsfc.nasa.gov/help-8.3.0/processors/ProcessMapgen.html

If mapgen also disables the ofile textfield, you can try this on the command line (command line help is at the bottom of the help page)

Code: Select all

mapgen -i /Users/gulfcarbon/Desktop/Chlorophyll_MODIS/l2files.txt -o /Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.2003052320030617.L3m.nc --product chlor_a --oformat netcdf4

Re: Batch processing in Seadas

Posted: Wed Aug 30, 2023 2:19 pm America/New_York
by arnabp893
I have the L2 root file
(base) Euricos-iMac:~ gulfcarbon$ /Users/gulfcarbon/ocssw/bin/obpg_file_type /Users/gulfcarbon/AQUA_MODIS.20030103T192000.L2.OC_BFW.nc
AQUA_MODIS.20030103T192000.L2.OC_BFW.nc: MODIS Aqua: Level 2.

Chl.nc file came unknown: unknown

It is better to work with the root file rather than changing the metadata of processed chlorophyll file. If I like to georeference list of files L2 files, how to write the .par file?
Like I can start as this in the par file
[main]
ifile=/Users/gulfcarbon/Downloads/MODIS_L1A/ifile_text/reproject.txt
odir=/Volumes/IomegaHDD/Reproject
what to add as other other command such as resolution, Datum etc.?
for reference I have this WKT while I am using the Reprojection feature in Seadas GUI
GEOGCS["WGS84(DD)",
DATUM["WGS84",
SPHEROID["WGS84", 6378137.0, 298.257223563]],
PRIMEM["Greenwich", 0.0],
UNIT["degree", 0.017453292519943295],
AXIS["Geodetic longitude", EAST],
AXIS["Geodetic latitude", NORTH],
AUTHORITY["EPSG","4326"]

Re: Batch processing in Seadas

Posted: Wed Aug 30, 2023 6:09 pm America/New_York
by OB SeaDAS - xuanyang02
Here is the command line help of mapgen -- https://seadas.gsfc.nasa.gov/help-8.3.0/processors/ProcessMapgen.html#cl

You can add --resolution --projection as the argument.

Code: Select all

mapgen -i /Users/gulfcarbon/Desktop/Chlorophyll_MODIS/l2files.txt -o /Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.2003052320030617.L3m.nc --product chlor_a --oformat netcdf4
You can also do

Code: Select all

mapgen -p mapgen-par12345.par
The example content of mapgen-par12345.par can be

ifile=/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/l2files.txt
ofile=/Users/gulfcarbon/Desktop/Chlorophyll_MODIS/AQUA_MODIS.2003052320030617.L3m.nc
product=chlor_a
projection=lambert
oformat=netcdf4