| # 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" | |