#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Princeton University # https://www.ncei.noaa.gov/thredds/catalog/OisstBase/NetCDF/AVHRR/catalog.html import os, sys, pandas as pd from climdata import run_shell start_date = '1981-09-01' end_date = '2018-10-15' dates = pd.date_range(start=start_date, end=end_date, freq='D') for d in dates: year, month, day = d.year, d.month, d.day ifile = f'https://www.ncei.noaa.gov/thredds/fileServer/OisstBase/NetCDF/AVHRR/{year}{month:02d}/avhrr-only-v2.{year}{month:02d}{day:02d}.nc' ofile =f"raw/{ifile.split('/')[-1]}" if os.path.exists(ofile): print('[File exists]:', ofile) continue else: cmd = f'wget {ifile} -O {ofile}' run_shell(cmd)