diff --git a/binder/environment.yml b/binder/environment.yml index 79044d7aa..8e83de5a3 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -6,3 +6,7 @@ dependencies: - jupyterlab - jupyter_server - sphinx-pythia-theme + - arm_pyart + - xradar + - wradlib + - matplotlib diff --git a/environment.yml b/environment.yml index 79044d7aa..8e83de5a3 100644 --- a/environment.yml +++ b/environment.yml @@ -6,3 +6,7 @@ dependencies: - jupyterlab - jupyter_server - sphinx-pythia-theme + - arm_pyart + - xradar + - wradlib + - matplotlib diff --git a/install/baltrad/install_baltrad.sh b/install/baltrad/install_baltrad.sh new file mode 100755 index 000000000..6f2260f51 --- /dev/null +++ b/install/baltrad/install_baltrad.sh @@ -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 \ No newline at end of file diff --git a/install/baltrad/install_baltrad_beamb.sh b/install/baltrad/install_baltrad_beamb.sh new file mode 100755 index 000000000..78d53a13e --- /dev/null +++ b/install/baltrad/install_baltrad_beamb.sh @@ -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>/ \n<\/rave-pgf-quality-registry>/g' $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml; +fi diff --git a/install/baltrad/install_baltrad_bropo.sh b/install/baltrad/install_baltrad_bropo.sh new file mode 100755 index 000000000..ee968908c --- /dev/null +++ b/install/baltrad/install_baltrad_bropo.sh @@ -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>/ \n<\/rave-pgf-quality-registry>/g' $CONDA_PREFIX/rave/etc/rave_pgf_quality_registry.xml; +fi diff --git a/install/baltrad/install_baltrad_drqc.sh b/install/baltrad/install_baltrad_drqc.sh new file mode 100755 index 000000000..cc9b3115c --- /dev/null +++ b/install/baltrad/install_baltrad_drqc.sh @@ -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 diff --git a/install/baltrad/install_baltrad_hlhdf.sh b/install/baltrad/install_baltrad_hlhdf.sh new file mode 100755 index 000000000..6a8426737 --- /dev/null +++ b/install/baltrad/install_baltrad_hlhdf.sh @@ -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 diff --git a/install/baltrad/install_baltrad_rave.sh b/install/baltrad/install_baltrad_rave.sh new file mode 100755 index 000000000..d32e22905 --- /dev/null +++ b/install/baltrad/install_baltrad_rave.sh @@ -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 diff --git a/install/baltrad/install_baltrad_rave_gmap.sh b/install/baltrad/install_baltrad_rave_gmap.sh new file mode 100755 index 000000000..94b7176a3 --- /dev/null +++ b/install/baltrad/install_baltrad_rave_gmap.sh @@ -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 diff --git a/install/baltrad/install_baltrad_short_course.sh b/install/baltrad/install_baltrad_short_course.sh new file mode 100755 index 000000000..f4ac3af41 --- /dev/null +++ b/install/baltrad/install_baltrad_short_course.sh @@ -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 diff --git a/install/baltrad/install_baltrad_wrwp.sh b/install/baltrad/install_baltrad_wrwp.sh new file mode 100755 index 000000000..841be3368 --- /dev/null +++ b/install/baltrad/install_baltrad_wrwp.sh @@ -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 diff --git a/install/baltrad/rave_gmap/setup.py b/install/baltrad/rave_gmap/setup.py new file mode 100644 index 000000000..941ec97ad --- /dev/null +++ b/install/baltrad/rave_gmap/setup.py @@ -0,0 +1,99 @@ +''' +Copyright (C) 2010 Swedish Meteorological and Hydrological Institute, SMHI, + +This file is part of the google maps plugin for rave. + +GoogleMapsPlugin is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GoogleMapsPlugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with GoogleMapsPlugin. If not, see . +------------------------------------------------------------------------*/ + +Setup script for installing the google maps plugin for rave. +Requires rave and pyhl (hlhdf). + +Usage: + python setup.py install [--prefix=...] + + --prefix default is /opt/baltrad + + In order to use this plugin you are required to generate a + products.js script in the web-directory by invoking the + GenerateProductInfo.py script. + + You will also need a php-capable www-server like apache + that is configured to have a path to the web-catalog. +@file +@author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI) +@date 2010-11-30 +''' +from distutils.core import setup + +if __name__ == "__main__": + import sys, distutils, os, glob + try: + import _pyhl + except Exception: + print("Gmap rave plugin requires _pyhl in order to work properly") + + try: + import _rave + except Exception: + print("Gmap rave plugin requires _rave in order to work properly") + + # Setup the default install prefix + prefix = "/opt/baltrad" + + # Get the install prefix if one is specified from the command line + for arg in sys.argv: + if arg.startswith('--prefix='): + prefix = arg[9:] + prefix = os.path.expandvars(prefix) + + ipath = prefix+"/rave_gmap" + + setup(name='RAVE Google Maps Plugin', + version='0.1', + description='Google Maps plugin for RAVE', + author='Anders Henja', + author_email='anders@baltrad.eu', + url='http://www.baltrad.eu', + extra_path = ipath + "/Lib", # all modules go here + packages=[], + package_dir={"" : "src"}, + data_files=[(ipath+'/web/css', glob.glob('web/css/*.css')), + (ipath+'/web/img', glob.glob('web/img/*.png')+glob.glob('web/img/*.jpg')+glob.glob('web/img/*.gif')), + (ipath+'/web/img', glob.glob('web/img/*.ico')), + (ipath+'/web/js', glob.glob('web/js/*.js')), + (ipath+'/web', glob.glob('web/*.php')), + (ipath+'/web', glob.glob('web/*.html')), + (ipath+'/web', glob.glob('web/*.xml')), + (ipath+'/Lib', glob.glob('src/*.TTF')), + (ipath+'/Lib', glob.glob('src/*.xml')), + (ipath+'/Lib', glob.glob('src/*.py')), # 2022: add Python modules + (ipath, ["README", "README.ravepgf", "README2", "LICENSE", "COPYING", "COPYING.LESSER"])] + ) + + # Only perform this operation during installation + isinstalling = 0 + for item in sys.argv: + if item=="install": + isinstalling = 1 + if isinstalling: + # Very non-standard. Needs to be migrated away from distutils in future. + source = distutils.sysconfig.get_python_lib() + '/easy-install.pth' + pth = distutils.sysconfig.get_python_lib() + '/rave_gmap.pth' + with open(pth, 'w') as f: f.write('%s/Lib\n' % ipath) + eggpth = distutils.sysconfig.get_python_lib() + open(source, 'r').read()[1:-1] + os.remove(eggpth) + os.remove(source) + print("GoogleMapsPlugin installed to %s" % ipath) + print("PTH file installed to %s" % pth) diff --git a/install/baltrad/rave_gmap/web/data/cawkr_gmaps.tgz b/install/baltrad/rave_gmap/web/data/cawkr_gmaps.tgz new file mode 100644 index 000000000..4706b59ef Binary files /dev/null and b/install/baltrad/rave_gmap/web/data/cawkr_gmaps.tgz differ diff --git a/install/baltrad/rave_gmap/web/products.js b/install/baltrad/rave_gmap/web/products.js new file mode 100644 index 000000000..d0f9ca00e --- /dev/null +++ b/install/baltrad/rave_gmap/web/products.js @@ -0,0 +1,27 @@ +function RadarProduct() { + this.product = ''; + this.description = ''; + this.lon = 0.0; + this.lat = 0.0; + zoom = 5; + this.nelon = 0.0; + this.nelat = 0.0; + this.swlon = 0.0; + this.swlat = 0.0; +} + +var radar_products = {}; + +var radar_option_list = new Array(); + +radar_products['cawkr_gmaps'] = new RadarProduct; +radar_products['cawkr_gmaps'].description = 'King City, ON'; +radar_products['cawkr_gmaps'].lon = -79.57416; +radar_products['cawkr_gmaps'].lat = 43.96388; +radar_products['cawkr_gmaps'].zoom = 6; +radar_products['cawkr_gmaps'].nelon = -77.690089; +radar_products['cawkr_gmaps'].nelat = 45.319843; +radar_products['cawkr_gmaps'].swlon = -81.454030; +radar_products['cawkr_gmaps'].swlat = 42.608139; +radar_option_list[0] = 'cawkr_gmaps'; + diff --git a/install/baltrad/rave_gmap/web/smhi-areas.xml b/install/baltrad/rave_gmap/web/smhi-areas.xml new file mode 100644 index 000000000..a20340e4e --- /dev/null +++ b/install/baltrad/rave_gmap/web/smhi-areas.xml @@ -0,0 +1,18 @@ + + + + + + + +