Skip to content

Commit

Permalink
ADD: Add build scripts for BALTRAD from ERAD2022 (#13)
Browse files Browse the repository at this point in the history
* ADD: Add build scripts from ERAD2022

* ADD: Add new packages to env
  • Loading branch information
mgrover1 authored Jun 24, 2024
1 parent 3940dc6 commit 48e259f
Show file tree
Hide file tree
Showing 15 changed files with 436 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ dependencies:
- jupyterlab
- jupyter_server
- sphinx-pythia-theme
- arm_pyart
- xradar
- wradlib
- matplotlib
4 changes: 4 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ dependencies:
- jupyterlab
- jupyter_server
- sphinx-pythia-theme
- arm_pyart
- xradar
- wradlib
- matplotlib
29 changes: 29 additions & 0 deletions install/baltrad/install_baltrad.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# enter build directory
cd $BALTRAD_INSTALL_ROOT

# remove tmp folder (needed for local builds)
rm -rf $BALTRAD_INSTALL_ROOT/tmp

# create tmp folder
mkdir tmp

# create baltrad activation script for conda environment
touch ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
ls -lart ${CONDA_PREFIX}/etc/conda/activate.d/

# install baltrad components in correct order, output to log files
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_hlhdf.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_hlhdf.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_rave.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_rave.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_beamb.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_beamb.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_bropo.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_bropo.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_wrwp.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_wrwp.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_drqc.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_drqc.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_rave_gmap.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_rave_gmap.log
${CONDA_PREFIX}/bin/bash -l $BALTRAD_INSTALL_ROOT/install/baltrad/install_baltrad_short_course.sh 2>&1 |tee $BALTRAD_INSTALL_ROOT/tmp/install_baltrad_short_course.log
36 changes: 36 additions & 0 deletions install/baltrad/install_baltrad_beamb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib:$CONDA_PREFIX/rave/lib

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth=1 https://github.com/baltrad/beamb.git
cd beamb/

# build, test and install
./configure --prefix=$CONDA_PREFIX/beamb --with-rave=$CONDA_PREFIX/rave
make
make test
make install
echo $CONDA_PREFIX/beamb/share/beamb/pybeamb > $CONDA_PREFIX/lib/python3.9/site-packages/beamb.pth

# activation script
grep -l beamb ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
if [[ $? == 1 ]] ;
then
echo "export PATH=\"\$PATH:$CONDA_PREFIX/beamb/bin\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$CONDA_PREFIX/beamb/lib\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
fi

# plugin
grep -l beamb $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml
if [ $? == 1 ] ;
then
sed -i 's/<\/rave-pgf-quality-registry>/ <quality-plugin name="beamb" module="beamb_quality_plugin" class="beamb_quality_plugin"\/>\n<\/rave-pgf-quality-registry>/g' $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml;
fi
35 changes: 35 additions & 0 deletions install/baltrad/install_baltrad_bropo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib:$CONDA_PREFIX/rave/lib

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth 1 https://github.com/baltrad/bropo.git
cd bropo/

# build, test and install
./configure --prefix=$CONDA_PREFIX/bropo \
--with-rave=$CONDA_PREFIX/rave \
--with-png=$CONDA_PREFIX
make
make test
make install

# activation script
grep -l bropo ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
if [[ $? == 1 ]]; then
echo "export PATH=\"\$PATH:$CONDA_PREFIX/bropo/bin\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$CONDA_PREFIX/bropo/lib\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
fi

# plugin
grep -l ropo_quality_plugin $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml
if [[ $? == 1 ]]; then
sed -i 's/<\/rave-pgf-quality-registry>/ <quality-plugin name="ropo" module="ropo_quality_plugin" class="ropo_quality_plugin"\/>\n<\/rave-pgf-quality-registry>/g' $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml;
fi
20 changes: 20 additions & 0 deletions install/baltrad/install_baltrad_drqc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib:$CONDA_PREFIX/rave/lib
export RAVEROOT=$CONDA_PREFIX

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth 1 https://github.com/DanielMichelson/drqc_py3.git
cd drqc_py3/

# build, test, install
make
make test
make install
29 changes: 29 additions & 0 deletions install/baltrad/install_baltrad_hlhdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth=1 https://github.com/baltrad/hlhdf.git
cd hlhdf/

# build, test and install
./configure --prefix=$CONDA_PREFIX/hlhdf \
--with-hdf5=$CONDA_PREFIX/include,$CONDA_PREFIX/lib \
--enable-py3support \
--with-py3bin=$CONDA_PREFIX/bin/python3 \
--with-numpy=$CONDA_PREFIX/lib/python3.9/site-packages/numpy/core/include/numpy/
make
make test
make install
mv $CONDA_PREFIX/hlhdf/hlhdf.pth $CONDA_PREFIX/lib/python3.9/site-packages/.

# activation script
grep -l hlhdf ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
if [[ $? == 1 ]]; then
echo "export PATH=\"\$PATH:$CONDA_PREFIX/hlhdf/bin\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
fi
44 changes: 44 additions & 0 deletions install/baltrad/install_baltrad_rave.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth=1 https://github.com/baltrad/rave.git
cd rave
sed -i -e 's/import jprops/#import jprops/g' Lib/rave_bdb.py
sed -i -e 's/import jprops/#import jprops/g' Lib/rave_dom_db.py
sed -i -e 's/import jprops/#import jprops/g' Lib/rave_bdb.py
sed -i -e 's/from baltrad.bdbclient/#from baltrad.bdbclient/g' Lib/rave_bdb.py
sed -i -e 's/from keyczar import keyczar/#from keyczar import keyczar/g' Lib/BaltradFrame.py
# kmuehlbauer: This file is missing currently, so disabling
# cp -p ~/binder/baltrad/fix_shebang.sh bin/. # Copies in path to Python for conda

# build, test and install
./configure --prefix=$CONDA_PREFIX/rave \
--with-hlhdf=$CONDA_PREFIX/hlhdf \
--with-proj=$CONDA_PREFIX/include,$CONDA_PREFIX/lib \
--with-expat=$CONDA_PREFIX/include,$CONDA_PREFIX/lib \
--with-numpy=$CONDA_PREFIX/lib/python3.9/site-packages/numpy/core/include/numpy/ \
--with-netcdf=$CONDA_PREFIX/include,$CONDA_PREFIX/lib \
--with-python-makefile=$CONDA_PREFIX/lib/python3.9/config-3.9-x86_64-linux-gnu/Makefile
make
make test
make install
# Copy files that need (temporary) monkeying to transition to Py3
# kmuehlbauer: not sure, if this is needed any more, disabling for now
# cp -r ~/binder/baltrad/opt/baltrad/rave/Lib/* $CONDA_PREFIX/rave/Lib/

# activation script
grep -l rave ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
if [[ $? == 1 ]]; then
echo "export RAVEROOT=$CONDA_PREFIX" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export PATH=\"\$PATH:$CONDA_PREFIX/rave/bin\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$CONDA_PREFIX/rave/lib\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
fi
43 changes: 43 additions & 0 deletions install/baltrad/install_baltrad_rave_gmap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib:$CONDA_PREFIX/rave/lib

# dependencies
# kmuehlbauer todo: this needs fixing as it doesn't work atm
#sudo apt-get install -qq libfreetype6-dev
# kmuehlbauer this need s to be done at another place, no sudo available
#sudo apt-get install -qq apache2
#sudo apt-get install -qq php
#sudo apt-get install -qq libapache2-mod-php
#sudo cp /vagrant/vendor/etc/apache2/apache2.conf /etc/apache2/apache2.conf
#sudo cp /vagrant/vendor/etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf

# download, use tweaked setup.py
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth=1 https://github.com/baltrad/GoogleMapsPlugin.git
cd GoogleMapsPlugin/
cp $BALTRAD_INSTALL_ROOT/install/baltrad/rave_gmap/setup.py .

# build and install
python setup.py install --prefix=$CONDA_PREFIX
# Replace Google Maps with OpenStreetMap
cp web/index.html $CONDA_PREFIX/rave_gmap/web/.
rm $CONDA_PREFIX/rave_gmap/web/index.php

# Add an amazing case!
cp $BALTRAD_INSTALL_ROOT/install/baltrad/rave_gmap/web/smhi-areas.xml $CONDA_PREFIX/rave_gmap/web/.
cp $BALTRAD_INSTALL_ROOT/install/baltrad/rave_gmap/web/products.js $CONDA_PREFIX/rave_gmap/web/.
mkdir $CONDA_PREFIX/rave_gmap/web/data
cp $BALTRAD_INSTALL_ROOT/install/baltrad/rave_gmap/web/data/cawkr_gmaps.tgz $CONDA_PREFIX/rave_gmap/web/data/.
cd $CONDA_PREFIX/rave_gmap/web/data
tar xzf cawkr_gmaps.tgz
rm cawkr_gmaps.tgz

# Restart apache2 with the plugin contents
# sudo service apache2 restart
18 changes: 18 additions & 0 deletions install/baltrad/install_baltrad_short_course.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# download and install course notebooks, overwrite in any case
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth=1 https://github.com/DanielMichelson/baltrad_short_course.git
yes | cp -rf baltrad_short_course $BALTRAD_INSTALL_ROOT/notebooks/.
yes | rm -rf baltrad_short_course
git clone --depth=1 https://github.com/DanielMichelson/baltrad2wradlib.git
yes | cp -rf baltrad2wradlib $BALTRAD_INSTALL_ROOT/notebooks/.
yes | rm -rf baltrad2wradlib
git clone --depth=1 https://github.com/DanielMichelson/pyart2baltrad.git
yes | cp -rf pyart2baltrad $BALTRAD_INSTALL_ROOT/notebooks/.
yes | rm -rf pyart2baltrad
30 changes: 30 additions & 0 deletions install/baltrad/install_baltrad_wrwp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# show commands before execution
set -x

# do not fail GHA on nonzero exit status
set +e

# needed to find dependencies
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/hlhdf/lib:$CONDA_PREFIX/rave/lib

# HACK we need .../rave/tmp to exist
mkdir $CONDA_PREFIX/rave/tmp

# download
cd $BALTRAD_INSTALL_ROOT/tmp
git clone --depth 1 https://github.com/baltrad/baltrad-wrwp.git
cd baltrad-wrwp/

# build, test and install
./configure --prefix=$CONDA_PREFIX/baltrad-wrwp --with-rave=$CONDA_PREFIX/rave --with-blas=$CONDA_PREFIX/lib --with-cblas=$CONDA_PREFIX/lib --with-lapack=$CONDA_PREFIX/lib --with-lapacke=$CONDA_PREFIX/include,$CONDA_PREFIX/lib
make
make test
make install

# activation script
grep -l wrwp ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
if [[ $? == 1 ]]; then
echo "export PATH=\"\$PATH:$CONDA_PREFIX/baltrad-wrwp/bin\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$CONDA_PREFIX/baltrad-wrwp/lib\"" >> ${CONDA_PREFIX}/etc/conda/activate.d/baltrad.sh
fi
Loading

0 comments on commit 48e259f

Please sign in to comment.