解析値を中心に再構成したNetCDFデータ
http://database.rish.kyoto-u.ac.jp/arch/jmadata/gpv-netcdf.html
[2017年 2月 17日 金曜日 17:38:56 JST]
[/mnt/raid112MANDA/KakenA.H28/MSM]
[am@aofd165]
$ get.msm.sh 20160829 20160830
$ tree
.
|-- 2016
| |-- MSM-P
| | |-- 0829.nc
| | `-- 0830.nc
| `-- MSM-S
| |-- 0829.nc
| `-- 0830.nc
`-- get.msm.sh
$ srcdump.sh get.msm.sh
------------------------------
List of the following files:
------------------------------
get.msm.sh
------------------------------
Machine info
------------------------------
aofd165.bio.mie-u.ac.jp
/mnt/raid112MANDA/KakenA.H28/MSM
Fri Feb 17 17:41:54 JST 2017
======================
get.msm.sh
======================
#!/bin/bash
usage(){
echo
echo "Usage $0 [-t]"
echo "-t : test mode (do NOT download files)"
echo
}
export LANG=C
flagt="false"
while getopts t OPT; do
case $OPT in
"t" ) flagt="true" ; ;;
* ) usage; exit 1
esac
done
shift $(expr $OPTIND - 1)
if [ $# -lt 2 ];then
echo "Error : Wrong number of arguments."
echo "Usage: $0 start end directory"
echo "start : start day (YYYYMMDD)"
echo "end : end day (YYYYMMDD)"
echo "directry"
exit 1
fi
start=$1
end=$2
if [ $# -le 2 ]; then
homedir=$(pwd)
else
homedir=$3
fi
if [ ! -d ${homedir} ]; then
mkdir -p $homedir
# echo Error in $0 : No such directry, ${homedir}
# exit 1
fi
URL=http://database.rish.kyoto-u.ac.jp/arch/jmadata/data/gpv/netcdf
starts=$(date -d "${start}" '+%s')
ends=$(date -d "${end}" '+%s')
times=$(expr $ends - $starts)
days=$(expr $times / 86400 )
sdate=${start:0:4}/${start:4:2}/${start:6:2}
#echo $sdate
yesterday=$(date -d"$sdate"-1days '+%Y/%m/%d')
#echo $yesterday
n=0
while [ $n -le $days ]; do
today=$(date -d"$yesterday"+1days '+%Y/%m/%d')
yyyy=${today:0:4}
mm=${today:5:2}
dd=${today:8:2}
echo
pdir=MSM-P
sdir=MSM-S
lpdir=${yyyy}/${pdir}
lsdir=${yyyy}/${sdir}
mkdir -vp ${lpdir}
if [ $? -ne 0 ]; then
echo ERROR in $0 : Cannot create directory, ${lpdir}.
exit 1
fi
mkdir -vp ${lsdir}
if [ $? -ne 0 ]; then
echo ERROR in $0 : Cannot create directory, ${lsdir}.
exit 1
fi
echo
echo Going down to directory, ${yyyy}/${sdir}.
cd ${yyyy}
if [ $? -ne 0 ]; then
echo Error in $0 : Cannot go to directory, ${yyyy}
exit 1
fi
cd ${sdir}
if [ $? -ne 0 ]; then
echo Error in $0 : Cannot go to directory, ${sdir}
exit 1
fi
echo
cwd=$(pwd)
echo "Current directory, ${cwd}."
sfile=${URL}/${sdir}/${yyyy}/${mm}${dd}.nc
echo
if [ $flagt = "true" ]; then
echo "Testing: target file = ${sfile}"
else
wget ${sfile}
fi
echo
echo Going up to parent directory.
cd ..
echo
echo Going down to directory, ${pdir}.
cd ${pdir}
if [ $? -ne 0 ]; then
echo Error in $0 : Cannot go to directory, ${pdir}
exit 1
fi
echo
cwd=$(pwd)
echo "Current directory, ${cwd}."
pfile=${URL}/${pdir}/${yyyy}/${mm}${dd}.nc
echo
if [ $flagt = "true" ]; then
echo "Testing: target file = ${pfile}"
else
wget ${pfile}
fi
n=$(expr $n + 1)
yesterday=$today
echo
echo Going up to parent directory, ${homedir}.
cd ${homedir}
done
exit 0
----------------------
End of get.msm.sh
----------------------