#! /bin/csh -f ################################################################################ # SCRIPT # xd.download_CMORPH_data_1dy # # LANGUAGE # C-Shell Script # #------------------------------------------------------------------------------- # PURPOSE # This script is used to download 8km-30min CMORPH CDR data files from NCEI # data server for target date # # USAGE # xd.download_CMORPH_data_1dy # #------------------------------------------------------------------------------- # COMMAND-LINE VARIABLES # yyyymmdd : target date # ################################################################################ #======================================== # : location of the utility 'wget' #---------------------------------------- # NOTE: # You may need to modify this #======================================== set wget=/usr/bin/wget #========================================================================= # : base URL of 8km-30min CMORPH data files on NCEI data server # : header of 8km-30min CMORPH data file names #========================================================================= set base_url=https://www.ncei.noaa.gov/data/cmorph-high-resolution-global-precipitation-estimates/access/30min/8km/ set file_hdr=CMORPH_V1.0_ADJ_8km-30min #------------------------- # : target date #------------------------- if( $#argv < 1 ) then echo echo "#################################" echo "# #" echo "# parameter needed #" echo "# #" echo "#################################" echo exit endif set yyyymmdd=${1} set yyyy=`echo ${yyyymmdd} | cut -c1-4` set mm=`echo ${yyyymmdd} | cut -c5-6` set dd=`echo ${yyyymmdd} | cut -c7-8` #------------------------------------------------ # download data file for each hour in target date #------------------------------------------------ echo foreach hh (00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23) set ff=${file_hdr}_${yyyy}${mm}${dd}${hh}.nc ${wget} -q ${base_url}/${yyyy}/${mm}/${dd}/${ff} if( -f ${ff} ) then ls -l ${ff} else echo "${ff} missing" endif end echo exit