Skip to content

Instantly share code, notes, and snippets.

@r35krag0th
Last active June 6, 2023 02:47
Show Gist options
  • Save r35krag0th/ce83baab3b7da3157b74c7838a246d45 to your computer and use it in GitHub Desktop.
Save r35krag0th/ce83baab3b7da3157b74c7838a246d45 to your computer and use it in GitHub Desktop.
Building wgrib2
#!/usr/bin/env bash
# NOTE: This requires you to have Homebrew installed
# --> https://brew.sh/
# NOTE: You need to have Homebrew's GCC installed
# --> brew install gcc
wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
tar xvzf wgrib2.tgz
cd grib2/
# NOTE: gfortran is provided by the GCC homebrew formula
export CC=$(brew --prefix gcc)/bin/gcc-8
export FC=$(brew --prefix gcc)/bin/gfortran
echo -e "\033[32m==> \033[0mRunning MAKE"
make
echo ""
echo -e "\033[32m==> \033[0mRunning MAKE LIB"
make lib
# Tested and Working on Ubuntu 14.04 and 18.04
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install gfortran build-essential
wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
tar xvzf wgrib2.tgz
cd grib2/
export CC=gcc
export FC=gfortran
make && make lib
ls -alh wgrib2/wgrib2
wgrib2/wgrib2 -config
@JMSnyder1980
Copy link

There is a major flaw in the compilation code: I get an error message:

Grib.c:(.text+0x3f0): undefined reference to `aec_grib_out'

Please help me resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment