Introduction

This contains science processing software used within OBPG. It is provided here with NO SUPPORT. For fully supported code, please use the binaries distributed with SeaDAS https://seadas.gsfc.nasa.gov/

OCSSW_bash.env (OCSSW.env for csh) is provided for setting needed environment variables to build the software.

REQUIREMENTS:

  • gcc (4.5 or higher)
  • g++ (matching gcc version)
  • gfortran (matching gcc version)
  • zlib
  • csh
  • tcsh
  • unzip
  • git
  • cmake
  • bison
  • flex
  • libX11-devel

additional known OS-specific requirements

  • Ubuntu 16.04
    • zlib1g-dev
  • CentOS 7
    • glibc-static
    • libgfortran-static
    • zlib-static
    • gmp-static
    • libjpeg-turbo-static
    • libstdc++-static
  • Mac:
    • libX11 can be installed by XQuartz

Building the code

CMake is used for the build system with a CMakeLists.txt file in each directory.

Here are the steps needed to build using bash, cmake and make:

  1. Get a copy of the ocssw source git repository
1 $ git clone https://oceandata.sci.gsfc.nasa.gov/ocssw/ocssw-src.git [optional target directory name]

Note: OBPG staff developers with access to the deveopment repository can do the following instead:

1 git clone https://oceandata.sci.gsfc.nasa.gov/rcs/obpg/ocssw.git [optional target directory name]
2 
3 or when on OBPG internal network, with ssh key in gitlab:
4 git clone git@oceanrcs101:obpg/ocssw.git
5 
6 git submodule init
7 git submodule update
  1. Setup environment variables (usually in ~/.bashrc)
1 $ export CC=gcc
2 $ export CXX=g++
3 $ export FC=gfortran
4 $ export OCSSWROOT=$HOME/ocssw
5 $ export OCSSW_DEBUG=1 #set to 0 if not debugging
6 $ source $OCSSWROOT/OCSSW_bash.env
  1. Grab the third party library sources and put them in opt
1 $ cd $OCSSWROOT/opt
2 $ wget https://oceandata.sci.gsfc.nasa.gov/ocssw/opt-src.tar
3 $ tar -xvf opt-src.tar

Note: OBPG staff developers can use the get_lib3_src.sh script to obtain these

  1. Build and install the third party libs
1 $ cd $OCSSWROOT/opt/src
2 $ export OCSSW_DEBUG=0 #probably do not want to debug these
3 $ ./BuildIt
  1. Create build directory and run cmake

    CMake allows for out-of-source-tree builds. Make a directory for this and run cmake within it, e.g.:

1 $ cd <ocssw source directory> (e.g. $OCSSWROOT/ocssw-src)
2 $ mkdir build
3 $ cd build
4 $ cmake ..

Note: There are a few options you can give to cmake to control what extra software is built:

1 BUILD_VIIRS_L1 - Build VIIRS L1 code
2  (not yet open source)
3 BUILD_HISTORICAL - Build the historical code
4  (e.g. old seawifs binaries no longer needed)
5 BUILD_MISC - Build non-essential code
6 BUILD_AHMAD_FRASER - Build the AF radiative transfer code
7  (not distributed)
8 BUILD_ALL - Build everything we got
9 
10 The "cmake .." command is run like this to use one or more of these options:
11 
12 cmake .. -DBUILD_HISTORICAL=ON -DBUILD_MISC=ON
13 
14 Please be aware that not all the code required for these options
15 is available in the externally accessible source repository
  1. Build the OCSSW binaries
1 $ cd <ocssw build directory> (e.g. $OCSSWROOT/ocssw-src/build)
2 $ export OCSSW_DEBUG=1 #could be set to 0 if not debugging
3 $ make -j 20
  1. Install binaries into $OCSSWROOT/bin
1 $ make install
  1. Grab all the data trees

    See https://oceandata.sci.gsfc.nasa.gov/ocssw/ for manual installation or use install_ocssw.py or the SeaDAS GUI

    Note: OBPG staff developers can use the following:

1 $ cd <cmake build directory>
2 $ make update #This command will take a LONG time

IDE setup

NetBeans

Here are the steps needed to use NetBeans for programming and debugging:

  1. download, build and install OCSSW as described above. Make sure to set OCSSW_DEBUG=0 before building 3rd party libs and setting OCSSW_DEBUG=1 before building OCSSW code.
  2. setup the correct compilers
1 menu Tools -> Options
2 
3 select C/C++
4 
5 select Build Tools tab
6 
7 Base Directory = /usr/bin
8 C Compiler = /usr/bin/gcc-5
9 C++ Compiler = /usr/bin/g++-5
10 Fortran Compiler = /usr/bin/gfortran-5
11 Assembler = /usr/bin/as
12 Make Command = /usr/bin/make
13 Debugger Command = /usr/bin/gdb
14 QMake Command = /usr/bin/qmake
15 CMake Command = /usr/bin/cmake
16 
17 click OK
  1. load the project into netbeans
1 menu File -> New Project
2 
3 select C/C++
4 select C/C++ Project with Existing Sources
5 
6 click Next
7 
8 Folder that contains existing source = $OCSSWROOT
9 (substitute the real dir for $OCSSWROOT)
10 
11 Build Host = localhost
12 Tool Collection = Default GNU
13 Configuration Mode = Custom
14 
15 click Next
16 
17 check Pre-Build Step is Required
18 Run in Folder = $OCSSWROOT/build
19 select Predefined Command
20 Script type = CMake
21 Script = $OCSSWROOT/CMakeLists.txt
22 Arguments = (the default is fine)
23 
24 click Next
25 
26 (Build Actions)
27 
28 click Next
29 
30 (Source Files)
31 Source File Folders = $OCSSWROOT
32 (Exclude Pattern)
33 ^(nbproject|.git|opt|share|test|var)$
34 
35 click Next
36 
37 (Code Assistance Configuration)
38 
39 click Next
40 
41 (Project Name and Location)
42 
43 click Finish
  1. Setup a run configuration
1 menu Run -> Set Project Configuration -> Customize...
2 
3 click Manage Configurations...
4 click New
5 
6 New Name = l2gen (or whatever you want)
7 
8 select l2gen
9 click Set Active
10 
11 click OK
12 
13 select Categories: Build -> Make
14 Working Directory = build
15 Build Command = ${MAKE} -j 20
16 Clean Command = ${MAKE} clean
17 Build Result = build/src/l2gen/l2gen
18 
19 select Categories: Run
20 Run Command = "${OUTPUT_PATH}" par=S2002079035435.L2_MLAC_OC.subpix.par
21 Run Directory = $OCSSWROOT/test/l2gen/seawifs
22 Environment =
23 Build First = checked
24 Console Type = Internal Terminal
25 External Terminal Type = Default
26 
27 click OK

Now you can Run or Debug

  1. Setup OBPG standard code formatting style
1 select menu Tools->Options
2 select "Editor" icon on top
3 select "Formatting" tab
4 Make sure "Language: All Languages"
5 Check "Expand Tabs to Spaces"
6 Number of spaces = 4
7 for each language (C, C++, C/C++ Headers) change
8 select Style = K&R
9 under "Braces Placement" heading
10 Function Declaration = Same Line

Eclipse

Here are the steps needed to use eclipse for programming and debugging:

  1. download, build and install OCSSW as described above. Make sure to set OCSSW_DEBUG=0 before building 3rd party libs and setting OCSSW_DEBUG=1 before building OCSSW code.
  2. load the project into eclipse
1 menu File -> New -> C++ Project Project Name:
2 make up a name for the project
3 
4 uncheck Use Default
5 Location Location = $OCSSWROOT (substitute your val for $OCSSWROOT)
6 
7 Project type:
8 Makefile Project -> Empty Project
9 
10 Toolchains = "Linux GCC" for Linux, "MacOSX GCC" for mac
11 
12 Next Advanced Settings (button)
13 
14 C/C++ Build (list item)
15 
16 Builder Settings (tab)
17 uncheck "Use default build command"
18 Build Command = make -j 20
19 uncheck "Generate Makefiles automatically"
20 Build Location = ${workspace_loc:/ocssw/build}
21 
22 Click on the OK Button.
23 Click on the Finish Button.
24 Wait a long time for the C/C++ Indexer to finish...
  1. make a run configuration to run l2gen
1 menu Run -> Run Configurations...
2 select C/C++ Application
3 click the icon with a plus sign on it
4 Name = l2gen-run
5 
6 Main tab C/C++ Application = build/src/l2gen/l2gen
7 
8 Arguments tab Program arguments = "par=S1997262224952.L2_LAC.par"
9 uncheck Use default
10 Working directory = $OCSSWROOT/test/l2gen (substitute your value)
11 
12 click Apply
13 click Run
  1. Setup OBPG standard code formatting style
1 menu Window -> Preferences General -> Editors -> Text Editors Display tab
2 width = 4
3 check "Insert spaces for tabs"
4 
5 C/C++ -> Code Style -> Formatter click "New..." button
6 Profile name = OCSSW Initialize settings with following profile: K&R [built-in]
7 click OK
8 
9 Indentation tab Tab policy:
10 Spaces only
11 Indentation size = 4
12 Tab size = 4
13 
14 Braces tab Function declaration: Same Line
15 
16 Line Wrapping tab check "Never join already wrapped lines"
17 
18 click OK
19 click Apply
20 click OK