- 积分
- 2419
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-3-31
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
基于官方下载脚本简单改了个可以自动下载的csh,结合crontab命令可以做到每天全自动下载
数据选择前天的是因为前天数据时段比较全
脚本如下,自己修改一下账号密码就行,把这个cshell加入crontab就行,百度一下都有教程
#!/bin/csh
#################################################################
# Csh Script to retrieve 5 online Data files of 'ds083.2',
# total 194.62M. This script uses 'wget' to download data.
#
# Highlight this script by Select All, Copy and Paste it into a file;
# make the file executable and run it on command line.
#
# You need pass in your password as a parameter to execute
# this script; or you can set an environment variable RDAPSWD
# if your Operating System supports it.
#
# Contact rdahelp@ucar.edu (RDA help desk) for further assistance.
#################################################################
set email= 这里改成你自己注册的邮箱
set pswd = 这里改成你自己的密码
set date1=`date -d "-2 day" +%Y%m%d`
set v = `wget -V |grep 'GNU Wget ' | cut -d ' ' -f 3`
set a = `echo $v | cut -d '.' -f 1`
set b = `echo $v | cut -d '.' -f 2`
if(100 * $a + $b > 109) then
set opt = 'wget --no-check-certificate'
else
set opt = 'wget'
endif
set opt1 = '-O Authentication.log --save-cookies auth.rda_ucar_edu --post-data'
set opt2 = "email=$email&passwd=$pswd&action=login"
$opt $opt1="$opt2" https://rda.ucar.edu/cgi-bin/login
if ( $status == 6 ) then
echo 'Please check that your password is correct.'
echo "Usage: $0 YourPassword"
exit 1
endif
set opt1 = "-N --load-cookies auth.rda_ucar_edu"
set opt2 = "$opt $opt1 https://rda.ucar.edu/data/ds083.2/"
set filelist = ( \
grib2/2022/2022.09/fnl_${date1}_00_00.grib2 \
grib2/2022/2022.09/fnl_${date1}_06_00.grib2 \
grib2/2022/2022.09/fnl_${date1}_12_00.grib2 \
grib2/2022/2022.09/fnl_${date1}_18_00.grib2 \
)
while($#filelist > 0)
set syscmd = "$opt2$filelist[1]"
echo "$syscmd ..."
$syscmd
shift filelist
end
|
|