I got the IT guys at work to find a dusty old PC and to install Linux on it. Tucked safely away in a corner somewhere, it's running a daily script that downloads the RTOFS 144 hour forecast and then produces SVP Weather Maps. These are then dumped on the FTP server where they are publicly available after an anonymous FTP login.
You can find the daily forecast here: Today's SVP Weather Map.
If you're a command line scripter, you might be interested in the details of the script:
#!/bin/bash
source ~/.bash_profile
# http://nomads.ncep.noaa.gov/pub/data/nccf/com/rtofs/prod/rtofs.20120212/rtofs_glo_3dz_f024_daily_3zsio.nc
base_url="http://nomads.ncep.noaa.gov/pub/data/nccf/com/rtofs/prod/rtofs"
# This forces us to download yesterday's grids since we want the full 144 hour forecast and that won't be
# available until the end of today.
#day=`date -v -1d '+%Y%m%d'`
day=`date --date="yesterday" '+%Y%m%d'`
file_prefix="rtofs_glo_3dz_f"
file_suffix_salinity="_daily_3zsio.nc"
file_suffix_temperature="_daily_3ztio.nc"
cd /home/jbeaudoin/data/RTOFS
mkdir -p $day
cd $day
for hour in 024 048 072 096 120 144;
do
echo "Doing hour" $hour
name=$base_url.$day/$file_prefix$hour$file_suffix_temperature
echo "Retrieving" $name
wget -N $name
name=$base_url.$day/$file_prefix$hour$file_suffix_salinity
echo "Retrieving" $name
wget -N $name
temperature_file=$file_prefix$hour$file_suffix_temperature
salinity_file=$file_prefix$hour$file_suffix_salinity
echo "Doing " $hour $temperature_file $salinity_file
# Do the uncertainty analysis, it dumps out a results_YYYYMMDD.dat file
svp_rtofs \
-angular_sector 120 \
-draft 5 \
-t $temperature_file \
-s $salinity_file
# Daily download footprint is 24GB. No need to hang on
# to these so clearing them out.
rm $temperature_file
rm $salinity_file
done
rm .gmt*
makecpt -Crainbow -T0/0.5/0.1 -Z -D > uncertainty.cpt
gmtset CHAR_ENCODING ISOLatin1Encoding
today=`date '+%Y%m%d'`
for f in *.dat;
do
prefix=`get_prefix $f`
# results_20120524.dat
datestamp=`basename $prefix | awk -F_ '{print $2}' `
rm $prefix.grd
cat $f | awk '{if (NF == 3) {printf("%.7f %.7f %.2f\n", $2,$1,$3);} }' | nearneighbor -I3m -S10m -R-180/180/-75/80 -N8/1 -G$prefix.grd
grdimage $prefix.grd -R -JM8i -K -Xc -Y1.75i -Q -Cuncertainty.cpt -K > $prefix.ps
pscoast -R -J -O -K -Gblack -W0.1p -Dl -A500/0/1 -B30g30/20g20 -Wthinner,black -U >> $prefix.ps
echo "60 50 20 0 1 BL $datestamp" | pstext -R -J -O -Gyellow -K >> $prefix.ps
psscale --LABEL_FONT_SIZE=15p -D4.0i/-0.5i/6i/0.3ih -O -Cuncertainty.cpt -B0.1:"Depth Uncertainty, 60\260 beam angle (%w.d., 2@~s@~)": >> $prefix.ps
ps2raster -A -Tg -E600 $prefix.ps
convert -rotate 90 $prefix.png $prefix.png
if [ $datestamp -eq $today ]; then
# We always provide a "today" file so that people can
# bookmark the today file on the FTP site.
cp $prefix.png today.png
fi
gzip -f $f
done
At the end of the script, the .png files and the .grd files are uploaded to the CCOM FTP site.
Friday, May 25, 2012
Subscribe to:
Posts (Atom)