Page 1 of 1

Data processing

Posted: Sun Sep 13, 2020 5:31 am America/New_York
by madhusmita
I am using bash script file for data process.
I want to retrieve Rrs and Chlorophyll  from level2 data using all the correction algorithms available in SeaDAS.
Can anyone please provide the command details of how to give all the correction algorithms for retrieval of any ocean colour products.

Thanks in Advance:smile:

Data processing

Posted: Sun Sep 13, 2020 12:30 pm America/New_York
by gnwiii
I assume you plan to use l2gen (many times) with parameters that select various options related to atmospheric correction.   When exploring options for l2gen it is often helpful to use the GUI menus to browse available options and save a parameter file.    Menu entries for l2gen in the GUI are based on an XML file created by running l2gen, but other formats can be generated:

$ l2gen -h
l2gen 9.5.0-V2019.3 (Aug 16 2019 12:47:35)
Usage: l2gen 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.

  return value: 0=OK, 1=error, 110=north,south,east,west does not intersect
  file data.

The list of valid keywords follows:

   help (boolean) (alias=h) (default=false) = print usage information
   version (boolean) (default=false) = print the version
   dump_options (boolean) (default=false) = print
        information about each option
   dump_options_paramfile (ofile) = print
        information about each option to paramfile
   dump_options_xmlfile (ofile) = print
        information about each option to XML file
Note that the files created by l2gen contain extensive metadata to record the parameter settings used by l2gen so it is easy to verify that the settings you make are actually recognized by l2gen.

Data processing

Posted: Tue Sep 15, 2020 11:04 am America/New_York
by madhusmita
Thank you so much sir for your help and suggestions.
Yes your assumption is absolutely correct.
I want to retrieve chlorophyll in different times using all the 11 correction algorithms available in SeaDAS.
Still i am struggling, and unable to retrieve.
Could you please share some command details if its available.

Thanks in advance:smile:

Data processing

Posted: Tue Sep 15, 2020 2:18 pm America/New_York
by bruce
can you show us what error you get when you run it?

Data processing

Posted: Tue Sep 15, 2020 2:48 pm America/New_York
by gnwiii
It would help if you could tell us more about the error.  At which step does the script fail? 

When scripting a multi-stage process, it is best to break the process up into small steps, write scripts for each step in the process, and get them working one by one.  That way you (or forum readers) have only a few lines to check for each error.  Once the small scripts are working you can combine them with a good chance the overall processing will work, but with many short scripts you have additional options such as running some steps (e.g., generating level-2 files) in parallel.

I noticed few spaces in setting environment variables.  For example, the spaces in line:
OpMapFileOC= "A-" $Ymonth$Yyear "-d" $Ydom" -4KM-Entire-OC"
can be removed as follows:

There are also space in the line "L2inFileOC=L2Bin -OC -4km.txt"

You should not have a space after the "=":
$ a=b ; echo $a
$ a= c ; echo $a
bash: c: command not found...

The "${envVar}" construct makes it easier to see the variable names and protects against confusion if a letter follows the variable name.

It is usually best to avoid spaces in the values for environment variables.  When it can't be avoided, quotes can be used, but that tends to make the script less readable.

The file ends with two "done" statements, but the only "do" is closed by a "done" in the loop ending with "l2gen". 

You should not need to run "l2gen" with bash, so the line:
/bin/bash -c "l2gen ifile=$L1bFile par=$L1bFile.anc geofile=$GEOFile \
  ofile1=$L2File1 l2prod1='chlor_a, Kd_490, l2_flags'"

can be replaced by:
l2gen ifile=$L1bFile par=$L1bFile.anc geofile=$GEOFile \
  ofile1=$L2File1 l2prod1="chlor_a,Kd_490,l2_flags"