# Quick program to fetch NWM raw output. # Logan Karsten # National Center for Atmospheric Research # Research Applications Laboratory import datetime import subprocess hoursBack = 30 hoursLag = 6 bDate = datetime.datetime.now() for step in range(hoursBack,hoursLag,-1): dCurrent = bDate - datetime.timedelta(hours=step) for fcstHr in range(1,16): fcstHrStr = str(fcstHr) fcstHrStr = fcstHrStr.zfill(3) shortPath = "http://www.ftp.ncep.noaa.gov/data/nccf/com/nwm/prod/nwm." + \ dCurrent.strftime('%Y%m%d') + '/short_range/nwm.t' + \ dCurrent.strftime('%H') + 'z.short_range.channel_rt.f' + fcstHrStr + \ '.conus.nc.gz' cmd = 'wget ' + shortPath subprocess.call(cmd,shell=True) shortPath = "http://www.ftp.ncep.noaa.gov/data/nccf/com/nwm/prod/nwm." + \ dCurrent.strftime('%Y%m%d') + '/short_range/nwm.t' + \ dCurrent.strftime('%H') + 'z.short_range.land.f' + fcstHrStr + \ '.conus.nc.gz' cmd = 'wget ' + shortPath subprocess.call(cmd,shell=True) shortPath = "http://www.ftp.ncep.noaa.gov/data/nccf/com/nwm/prod/nwm." + \ dCurrent.strftime('%Y%m%d') + '/short_range/nwm.t' + \ dCurrent.strftime('%H') + 'z.short_range.terrain_rt.f' + fcstHrStr + \ '.conus.nc.gz' cmd = 'wget ' + shortPath subprocess.call(cmd,shell=True)