#!/bin/bash
clear
echo ' '
echo ' ***********************************'
echo ' *** Downloading Global Wind Data ***'
echo ' *** from NOAA FTP Server ***'
echo ' ***********************************'
echo ' '
# Setting up text type variables
bold=`tput bold`
normal=`tput sgr0`
# Setting up some variables
ftpdir=/pub/data/nccf/com/gfs/prod
server=ftp.ncep.noaa.gov
today=`date +%Y%m%d`
dir=$today;
hour=`date -u +%H`
OK=$NULL
if [ "$hour" -lt "6" ]; then
echo "Current time in GMT is: ${bold}`date -u +%R`${normal} "
echo -n "Continue anyway? [y/n] "
read OK
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "Continue anyway? [y/n] "
read OK
done
if [ "$OK" = 'n' ] || [ "$OK" = 'N' ]; then
echo -e "\n${bold}ABORTED BY USER!${normal}\n" ; exit 0
else
echo "${bold}WARNING! The data to be downloaded may be incomplete.${normal}"
fi
else
echo "Current time in GMT is: ${bold}`date -u +%R`${normal} ... seems OK!"
fi
# Changing work directory to home
cd ~
# Check to see if WDD directory exists
if [ -d "WDD" ]; then
echo -e "\nWDD directory exists!"
else
echo "Making WDD directory"
mkdir WDD
fi
# Changing work directory
cd WDD
# Check to see if directory with current date exists
if [ -d "$dir" ]; then
echo "${bold}$dir${normal} directory exists! Backing up existing directory..."
mv -v $dir $dir.bak
echo "Making $dir directory"
mkdir $dir
else
echo "Making $dir directory"
mkdir $dir
fi
# Changing work directory
cd $dir
# Defining filename to match ftp naming convention
filecon=z.master.grbf
# Downloading wind data files from server
for time in 00 03 06 09 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96;
do
filename=gfs.t00$filecon$time.10m.uv.grib2
echo "Downloading ${bold}$filename${normal}:"
curl -# -m 90 -C - ftp://$server$ftpdir/gfs."$today"00/$filename > $filename
echo -e "Converting $filename to spreadsheet format..."
wgrib2 $filename -spread $time.txt
echo " ";
done
# Merging file contents
echo "Merging downloaded data..."
cat *.txt > wind-pre.dat
# Removing temp files
echo "Removing temp files..."
rm -f *.txt
echo ' '
echo ' *******************************'
echo ' *** Completed! ***'
echo ' *******************************'
echo ' '
exit 0
WDD.sh.tar.gz_NOAA
版权申诉
58 浏览量
2022-09-23
00:09:15
上传
评论
收藏 1KB GZ 举报
alvarocfc
- 粉丝: 113
- 资源: 1万+
最新资源
- 数据分析案例-顾客购物数据可视化分析(数据集+代码).rar
- 19613fc3f7378acf2787f12bbf7a34a1.JPG
- mmexport1718846385059.jpg
- 后缀表达式求值.pdf
- 微信小程序商城项目源码(仿拼夕夕)
- QGroundcontrol 四机协同编队飞行日志
- 海信智能电视刷机数据 LED43EC520UA(0000) 生产用软件数据 务必确认机编一致 强制刷机 整机USB升级程序
- DirSearch-master.zip
- 02块状物品推送机的机构综合与设计.docx
- js库实现中缀表达式(即日常使用的四则运算表达式)转换成后缀表达式(逆波兰式),方便计算机计算
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈