File size: 1,260 Bytes
8d032c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/bash
# Script to install required tools for processing polar stereographic GRIB files
echo "Installing tools for GRIB polar stereographic processing..."
# Install wgrib2 (primary solution)
echo "Installing wgrib2..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
if command -v brew &> /dev/null; then
brew install wgrib2
else
echo "Please install Homebrew first: https://brew.sh"
echo "Then run: brew install wgrib2"
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install wgrib2
elif command -v yum &> /dev/null; then
sudo yum install wgrib2
elif command -v conda &> /dev/null; then
conda install -c conda-forge wgrib2
else
echo "Please install wgrib2 manually from: https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/"
fi
fi
# Install Python packages
echo "Installing Python packages..."
pip install pygrib pyproj xarray cfgrib
echo "Installation complete!"
echo ""
echo "Test wgrib2 installation:"
which wgrib2
wgrib2 -version
echo ""
echo "You can now run the polar GRIB processing scripts:"
echo "python fix_polar_grib.py"
echo "python pygrib_solution.py"
|