CNES / MAJA

Level-2A processor used for atmospheric correction and cloud-detection. The active repository is the one below, this one is kept to leave access to the older issues.
https://gitlab.orfeo-toolbox.org/maja/maja
Apache License 2.0
137 stars 25 forks source link

How to install MAJA 4 in Ubuntu 20.04 and Docker #80

Open jprankl opened 3 years ago

jprankl commented 3 years ago

This is not a typical issue, but a step by step example of how to install MAJA 4 in Ubuntu 20.04 and Docker.
Assumption: Docker is already installed.

Get Ubuntu 20.04 Docker container and go into the container

docker run -d -it --restart=always -v /srv/data:/data --name Maja4-Ub20 ubuntu:20.04 /bin/bash
docker exec -it Maja4-Ub20 /bin/bash

/srv/data is a data folder, which is linked into the container (to /data)

Install dependencies

apt -y update
apt -y install libffi-dev
apt -y install mono-complete
apt -y install bison flex
apt -y install libpcre++-dev
apt -y install wget
apt -y install lsof

Download and install binaries from CNES

https://logiciels.cnes.fr/en/node/58?type=tel

Optionally build MAJA from source

# install build dependency
apt -y install build-essential cmake pkg-config
apt -y install cmake-curses-gui
apt -y install git
apt -y install tmux

# build maja
mkdir /root/software
cd /root/software
git clone https://github.com/CNES/MAJA.git
cd MAJA
mkdir build
mkdir install
cd build
cmake ../SuperBuild -DDOWNLOAD_DIR=../SuperBuild-archives/ -DENABLE_TU=OFF -DENABLE_TV=OFF -DENABLE_TVA=OFF -DCMAKE_INSTALL_PREFIX=`pwd`/../install
make -j4

Start maja

Configure folders.txt according to https://github.com/CNES/MAJA
In case CAMS should be activated (--cams) follow https://github.com/CNES/MAJA#download-cams-data and download the cams data before
L1C data structure example (without specifying a site)
/data/sentinel_products_L1C-test/33UWP/S2A_MSIL1C_20200909T095031_N0209_R079_T33UWP_20200909T110415.SAFE

Start maja in case it is installed from the binary package in the default folder

/opt/maja/MAJA-4.2.1/bin/startmaja -f folders.txt -t 33UWP -d 2020-01-01 -e 2020-07-01 -v --type_dem srtm

...or start maja if it is built from source

/root/software/MAJA/install/maja/4.2.1/bin/startmaja -f folders.txt -t 33UWP -d 2020-01-01 -e 2020-07-01 -v --type_dem srtm
jprankl commented 3 years ago

@c00kiemon5ter would be nice if you could test the steps.

@olivierhagolle, I had a discussion with Ivan on how to install Maja in Ubuntu. I thought it might be also interesting for other people and started a new thread. I hope that's o.k.?

@olivierhagolle and @petket-5 I hacked a line into startmaja to configure the Muscate format. Is there a proper method to configure it? It might be nice to have a command-line option.

olivierhagolle commented 3 years ago

Hi @jprankl sorry, we are a bit too busy these days to reply quickly, but it's more than OK, thanks a lot for this contribution !

rohitshetty commented 3 years ago

Thanks a lot @jprankl for this information. I've created a repo with a proper Dockerfile in case anyone is interested in the future. https://github.com/rohitshetty/maja-docker

This compiles the Maja from the develop branch from gitlab. But for some weird reason make binpkg fails, so cannot yet create a standalone binary, but rest of it works.