Demo entry 6642793

bash

   

Submitted by anonymous on Sep 25, 2017 at 16:13
Language: Bash. Code size: 2.0 kB.

#!/bin/bash --login
echo ==============================
echo     2014-05-14  Created By KangXing
echo ===============================
date
source /home/xxxx/.bash_profile
source /home/xxxx/.bashrc
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/include
#===================================
#   SETTINGS
#===================================
HOUR_D=12
DAY_D=-1
START_MODEL_HOUR=12
START_MODEL_DAY=00
END_MODEL_DAY=5
END_MODEL_HOUR=12
#===========data source=======
WGET=/usr/bin/wget
GET=/usr/bin/lftp
#  for wrf
WPSDIR=~/WRF/WPS/
#===================================
stt=`date -d "$DAY_D days" +%Y%m%d`

echo DOWNLOADING gfs.${stt}${HOUR_D}
cd /home/xxxx/work_dir/wind_gfs  

mkdir  ${stt}_0p25

# ---.download---
if [ -e my_inv ];then
rm my_inv
fi

for i in `seq -w 0 3 192`;do
echo $i;
#$GET -c "pget -n 10 ftp://ftp.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.${stt}${HOUR_D}/gfs.t${HOUR_D}z.pgrb2.0p50.f$i"
touch ${stt}_0p25/gfs.t${HOUR_D}z.pgrb2.0p25.f$i.tmp
until [ ! -e ${stt}_0p25/gfs.t${HOUR_D}z.pgrb2.0p25.f$i.tmp ]
do
   echo ${stt}_0p25/gfs.t${HOUR_D}z.pgrb2.0p25.f$i.tmp 
   URL=http://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs.${stt}${HOUR_D}/gfs.t${HOUR_D}z.pgrb2.0p25.f$i
##   if [ ! -e my_inv ];then
   /home/xxxx/work_dir/wind_gfs/gfs_inv.pl $URL.idx > ${stt}_0p25/my_inv
##   fi
   egrep "(GRD:10 m a|PRMSL:mean|TMP:2 m a|DLWRF:|DSWRF:|RH:2 m a|PRATE|SPFH:2 m)" < ${stt}_0p25/my_inv | /home/xxxx/work_dir/wind_gfs/gfs_grib.pl $URL ${stt}_0p25/gfs.t${HOUR_D}z.pgrb2.0p25.f$i
done
done

###/home/xxxx/work_dir/wind_gfs/grib2nc ${stt}_0p25 ${stt}_0p25/${stt}_0p25.nc
###if [ ! -e  ${stt}_0p25/${stt}_0p25.nc.gz ]
###then
###cd ${stt}_0p25
###/bin/gzip ${stt}_0p25.nc
###fi

exit
cd /home/xxxx/work_dir/wind_gfs 
cat > ftp_GFS.txt <<EOF
open 172.16.2.20
user forecast forecast 
cd /IS5000/users/forecast/data
lcd /home/xxxx/work_dir/wind_gfs/${stt}_0p25 
put ${stt}_0p25.nc 
close
bye
EOF
cat ftp_GFS.txt | lftp

date

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).