#!/bin/bash
WGET='/usr/bin/wget'
YEAR='2007'
MONTH='01'
DAY='04'
StartSeq='0'
EndSeq='465'
NCSS='http://ncss.hycom.org/thredds/ncss/grid'
MODEL='GLBu0.08'
EXPT='expt_19.1'
VARS="var=water_u,water_v"
SPATIAL='spatial=bb'
NORTH='north=70'
SOUTH='south=40'
EAST='east=0'
WEST='west=-30'
for PlusDay in `seq $StartSeq $EndSeq`; do
MyTime=`date -d "$YEAR-$MONTH-$DAY +$PlusDay days" +%Y-%m-%dT%H:%M:%SZ`
TimeStart="time_start=$MyTime"
TimeEnd="time_end=$MyTime"
OutFile=$MODEL"_"$EXPT"_`echo $MyTime | cut -d 'T' -f 1`T00Z.nc"
URL="$NCSS/$MODEL/$EXPT?$VARS&$SPATIAL&$NORTH&$SOUTH&$EAST&$WEST&$TimeStart&$TimeEnd"
if [ -s $OutFile ]; then
echo "[warning] File $OutFile exists (skipping)"
else
wget -O $OutFile "$URL"
fi
done