Skip to content

Instantly share code, notes, and snippets.

@bruceh48
Created April 15, 2017 08:27
Show Gist options
  • Save bruceh48/15a6aa3bb0efeb944417f64d3f9aaeb7 to your computer and use it in GitHub Desktop.
Save bruceh48/15a6aa3bb0efeb944417f64d3f9aaeb7 to your computer and use it in GitHub Desktop.
Compile and install WGRIB2 - Installs WGRIB 2.0.6c
#!/bin/bash
apt-get update
apt-get install -y build-essential libaec-dev zlib1g-dev libcurl4-openssl-dev libboost-dev curl wget zip unzip bzip2 gfortran gcc g++
rm -rf /usr/local/grib2/
mkdir -p /usr/local/grib2/
cd /tmp/
if [ ! -f "/tmp/wgrib2.tgz" ]; then
wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz.v2.0.6c -O /tmp/wgrib2.tgz
fi
tar -xf /tmp/wgrib2.tgz
mv /tmp/grib2/ /usr/local/grib2/
cd /usr/local/grib2/grib2
export FC=gfortran && export CC=gcc
make && rm -rf /usr/local/bin/wgrib2
ln -s /usr/local/grib2/grib2/wgrib2/wgrib2 /usr/local/bin/wgrib2
rm /tmp/wgrib2.tgz
# -- Run
# wgrib2 to see if installed OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment