#!/bin/csh
# script to download the ghrsst from the website:
# https://opendap.jpl.nasa.gov/opendap/OceanTemperature/ghrsst/data/L4/GLOB/NAVO/K10_SST/2011/contents.html

set echo

setenv WD "https://opendap.jpl.nasa.gov/opendap/OceanTemperature/ghrsst/data/L4/GLOB/NAVO/K10_SST"
setenv WD "https://podaac-opendap.jpl.nasa.gov/opendap/allData/ghrsst/data/GDS2/L4/GLOB/NAVO/K10_SST/v1/"
set day=(31 29 31 30 31 30 31 31 30 31 30 31)
#foreach y ( 2009 2010 2011   )
foreach y (2023)
#foreach y (  2014 2015   )
 @ ddd1=32
 # foreach m ( 01 02 03 04 05 06 07 08 09 10 11 12 )
  foreach m ( 01 02  )
        @  dd=1
        while ( ${dd} <= ${day[${m}]})
        setenv ddd `echo ${ddd1} | awk '{printf("%03.0f", $1)}'`
        setenv d `echo ${dd} | awk '{printf("%02.0f", $1)}'`
	#wget  ${WD}"/${y}/${ddd}/${y}${m}${d}-NAVO-L4HR1m-GLOB-v01-fv01_0-K10_SST.nc.bz2"
        wget ${WD}"/${y}/${ddd}/${y}${m}${d}000000-NAVO-L4_GHRSST-SST1m-K10_SST-GLOB-v02.0-fv01.0.nc"
	@ dd = ${dd} + 1
        @ ddd1 = ${ddd1} + 1
        end 
 end
end
#https://opendap.jpl.nasa.gov/opendap/OceanTemperature/ghrsst/data/L4/GLOB/NAVO/K10_SST/2009/001/20090101-NAVO-L4HR1m-GLOB-v01-fv01_0-K10_SST.nc.bz2.html
