爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8493|回复: 6

求助!下载CFSR数据驱动WRF!

[复制链接]
发表于 2016-12-21 13:49:20 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本人想下载CFSR的数据来run WRF,主要是想使用wget来下载,通过点击下图中的create后出现了如下的一个脚本,本人表示完全看不懂,在此请教一下大家接下来改如何做!先在此谢谢大家了!
qq.png
#! /bin/csh -f
#
# c-shell script to download selected files from rda.ucar.edu using Wget
# NOTE: if you want to run under a different shell, make sure you change
#       the 'set' commands according to your shell's syntax
# after you save the file, don't forget to make it executable
#   i.e. - "chmod 755 <name_of_script>"
#
# Experienced Wget Users: add additional command-line flags here
#   Use the -r (--recursive) option with care
#   Do NOT use the -b (--background) option - simultaneous file downloads
#       can cause your data access to be blocked
set opts = "-N"
#
# Replace "xxxxxx" with your rda.ucar.edu password on the next uncommented line
# IMPORTANT NOTE:  If your password uses a special character that has special
#                  meaning to csh, you should escape it with a backslash
#                  Example:  set passwd = "my\!password"
set passwd = 'xxxxxx'
set num_chars = `echo "$passwd" |awk '{print length($0)}'`
if ($num_chars == 0) then
  echo "You need to set your password before you can continue"
  echo "  see the documentation in the script"
  exit
endif
@ num = 1
set newpass = ""
while ($num <= $num_chars)
  set c = `echo "$passwd" |cut -b{$num}-{$num}`
  if ("$c" == "&") then
    set c = "%26";
  else
    if ("$c" == "?") then
      set c = "%3F"
    else
      if ("$c" == "=") then
        set c = "%3D"
      endif
    endif
  endif
  set newpass = "$newpass$c"
  @ num ++
end
set passwd = "$newpass"
#
set cert_opt = ""
# If you get a certificate verification error (version 1.10 or higher),
# uncomment the following line:
#set cert_opt = "--no-check-certificate"
#
if ("$passwd" == "xxxxxx") then
  echo "You need to set your password before you can continue"
  echo "  see the documentation in the script"
  exit
endif
#
# authenticate - NOTE: You should only execute this command ONE TIME.
# Executing this command for every data file you download may cause
# your download privileges to be suspended.
wget $cert_opt -O auth_status.rda.ucar.edu --save-cookies auth.rda.ucar.edu.$$ --post-data="email=wangxuejin12@lzu.edu.cn&passwd=$passwd&action=login" https://rda.ucar.edu/cgi-bin/login
#
# download the file(s)
# NOTE:  if you get 403 Forbidden errors when downloading the data files, check
#        the contents of the file 'auth_status.rda.ucar.edu'
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090826-20090831.tar
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090901-20090905.tar
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090906-20090910.tar
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090911-20090915.tar
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090916-20090920.tar
wget $cert_opt $opts --load-cookies auth.rda.ucar.edu.$$ http://rda.ucar.edu/data/ds093.0 ... 090921-20090925.tar
#
# clean up
rm auth.rda.ucar.edu.$$ auth_status.rda.ucar.edu


密码修改失败请联系微信:mofangbao
发表于 2016-12-22 09:50:09 | 显示全部楼层
层主本人做过类似工作~
这个是c-shell脚本,从
# c-shell script to download selected files from rda.ucar.edu using Wget

# download the file(s)
都是问你要密码的
我一般把这些都删掉,然后把
wget $cert_opt -O auth_status.rda.ucar.edu --save-cookies auth.rda.ucar.edu.$$ --post-data="email=wangxuejin12@lzu.edu.cn&passwd=$passwd&action=login" https://rda.ucar.edu/cgi-bin/login
这一行里面的
passwd=$passwd
换成
passwd=你的密码
现在的linux默认的都是bash,用csh的话要在终端切换到c-shell,比如csh xxx.csh,或者直接敲csh
也可以把#! /bin/csh -f换成#! /bin/bash -f
---我是一条分割线---
不推荐楼楼用wget下数据,因为wget需要完全下载,不能只下载楼楼需要的那一部分
cfsr生成脚本的时候可以选择curl下载,那个和楼楼贴出来的脚本类似,但是可以只下载一部分数据,神器一枚~

祝楼楼wrf顺利
cheers~
密码修改失败请联系微信:mofangbao
发表于 2016-12-22 09:51:36 | 显示全部楼层
补充一下,这一行不能删哈
wget $cert_opt -O auth_status.rda.ucar.edu --save-cookies auth.rda.ucar.edu.$$ --post-data="email=wangxuejin12@lzu.edu.cn&passwd=$passwd&action=login" https://rda.ucar.edu/cgi-bin/login
这是验证用户名和密码的~
密码修改失败请联系微信:mofangbao
发表于 2018-4-18 13:57:55 | 显示全部楼层
ljchen1989 发表于 2016-12-22 09:51
补充一下,这一行不能删哈
wget $cert_opt -O auth_status.rda.ucar.edu --save-cookies auth.rda.ucar.ed ...

请问大神 :
set num_chars = `echo "$passwd" |awk '{print length($0)}'`
if ($num_chars == 0) then
  echo "You need to set your password before you can continue"
  echo "  see the documentation in the script"
  exit
endif
这几行脚本是什么意思呢?
密码修改失败请联系微信:mofangbao
发表于 2018-4-19 08:50:45 | 显示全部楼层
葡萄不是哭包 发表于 2018-4-18 13:57
请问大神 :
set num_chars = `echo "$passwd" |awk '{print length($0)}'`
if ($num_chars == 0) then ...

大神不敢当~
就是问你要密码啊,如果你没敲密码,就跟你说
You need to set your password before you can continue
see the documentation in the script
密码修改失败请联系微信:mofangbao
发表于 2018-4-19 09:03:31 | 显示全部楼层
http://computing.io/wp/2013/08/wrf-with-cfsr-data/
可以参考这个网站,说的很详细。
密码修改失败请联系微信:mofangbao
发表于 2020-4-27 10:51:21 | 显示全部楼层
请问具体如何解决的?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表