Skip to content

Instantly share code, notes, and snippets.

@cynici
Created December 10, 2012 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cynici/4249450 to your computer and use it in GitHub Desktop.
Save cynici/4249450 to your computer and use it in GitHub Desktop.
NPP: Download GDAS cron script
#! /bin/bash
#
# This script downloads all gdas1.PGrbF00.*.*.z of previous day or
# whichever day specified by '-d' options given to 'date' command
# into current directory.
#
# Download GDAS of a specific day using '-d' option of date command.
#
# The Global Data Assimilation System (GDAS) files are required
# by VIIRS TrueColorGen algorithm
#
set -e
if [ -t ]; then
verbose='--verbose'
else
verbose='--no-verbose'
fi
# Download GDAS of previous day by default
if [ $# -eq 0 ]; then
yymmdd=$(date +'%y%m%d' '-d yesterday')
else
yymmdd=$(date +'%y%m%d' "$@")
fi
for hour in "00" "06" "12" "18"; do
# Only download newer files
wget $verbose -N ftp://is.sci.gsfc.nasa.gov/ancillary/temporal/global/gdas/gdas1.PGrbF00.${yymmdd}.${hour}z
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment