Commit 2e85b2c4 authored by Dany Dumont's avatar Dany Dumont
Browse files

Ajout de wget_ogsl.sh qui permet de telecharger automatiquement des previsions oceaniques OGSL

parent 22d64a8d
#!/bin/bash
#
# Script used to dowload hourly 'currents', 'concentration' or 'thickness' from OGLS.ca
# By default, the model is 'G5' (Gulf 5km), but could be easily modified for 'STLE'
#
# ex: sh ./wget_ogsl.sh currents 2012 netcdf
#
#
# - Frederic Cyr, December 2012
# ----------------------------------------------------------------------------------- #
if [ $# -ne 3 ]
then
echo usage:
echo $0 model field_wanted year format
echo ex: sh wget_ogsl.sh currents 2012 netcdf
exit 1
fi
# replace input
field=$1
yyyy=$2
format=$3
for mm in $(seq 1 12)
do
if [ $mm -lt 10 ]
then
mm=0$mm
fi
for dd in $(seq 1 31)
do
if [ $dd -lt 10 ]
then
dd=0$dd
fi
for hh in $(seq 0 23)
do
if [ $hh -lt 10 ]
then
hh=0$hh
fi
date=${yyyy}-${mm}-${dd}
time=${hh}:00
# URL ex: http://ogsl.ca/ocean/productprovider?datatype=currents&model=G5&date=2012-12-17&time=10:00&format=netcdf
URL="https://ogsl.ca/ocean/productprovider?datatype=${field}&model=MOGSL&date=${date}&time=${time}&format=${format}"
OUTFILE="./${field}_${yyyy}-${mm}-${dd}_${hh}:00.nc"
wget -O - $URL > $OUTFILE
done
done
done
# VERIFY THIS IF YEAR = 2008, 2004, etc.
if [ $yyyy -ne 2012 ]
then
rm ./${field}_${yyyy}-02-29*
fi
rm ./${field}_${yyyy}-02-30*
rm ./${field}_${yyyy}-02-31*
rm ./${field}_${yyyy}-04-31*
rm ./${field}_${yyyy}-06-31*
rm ./${field}_${yyyy}-09-31*
rm ./${field}_${yyyy}-11-31*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment