From: fred@poly2.nist.gov (Frederick R. Phelan Jr.)
Newsgroups: comp.sys.sgi
Subject: Re: Euroweather data
Date: 15 Sep 92 20:15:36 GMT



Patrick HURT <thsspxh@iitmax.iit.edu> writes:
|
|In article <1992Sep11.114718.26874@ringer.cs.utsa.edu> senseman@ricky.brainlab.utsa.edu (David M. Senseman) writes:
|>In article <18n71qINNi9g@darkstar.UCSC.EDU> mmcohen@cats.ucsc.edu (Michael M Cohen) writes:
|>>
|>>Someone was asking about European weather maps
|>>for bgpaste? ... Should work with a bit of editing
|>>for the weather shell recently posted.
|>>
|>
|>The original post in this thread (which I missed somehow) mentioned
|>something about getting US weather maps but not European. Could someone
|>E-Mail me the site for getting US Weather maps? Thanks.
|>-- 
|
|Me too, please! Also, if anybody has a script getting the weather
|by ftp, and popping it up on the screen, please mail it to me.
|

Here's a revised version of the script I originally posted ...
the usage is:

	weather [options]

where options are

-usa : Paints root window to current weather map of USA

-europe : Uses current map of europe 
	 [Note that this site queries for a password, just
	  hitting return should be ok]

-query : Does a dir on the current USA weather map file
	 [I put this in because sometimes it doesn't get updated  
	  until about noon and the night versions are too dark.]

-getUSA : Downloads and stores current USA map in /usr/tmp/UsaWeatherMapFile.GIF

-paintUSA : Pastes /usr/tmp/UsaWeatherMapFile.GIF to root window


Thanks to mmcohen@cats.ucsc.edu for posting the European site for data.

Cheers,
Fred Phelan

--- weather ----
#!/bin/csh -f
# weathermap
# Sets the background to the latest weather map.
#
# Original:
# Ron Boisvert, NIST, 25 Jun 92
#
# Modified for SGI:
# F.R. Phelan Jr.
# NIST Polymers Division
# September 11, 1992
#

#
#Background info on weather map sites:
#
#nslookup vmd.cso.uiuc.edu
#Non-authoritative answer:
#Name:    VMD.CSO.UIUC.EDU
#Addresses:  128.174.5.98, 192.17.13.1
#
#nslookup cumulus.met.ed.ac.uk
#Non-authoritative answer:
#Name:    cumulus.met.ed.ac.uk
#Address:  129.215.168.19
#

#
#Default settings ...
#
set NameOfThisScript = weather

set infile = /usr/tmp/weather.$$.ftp
set gif_file = /usr/tmp/weather.$$.GIF
set rgb_file1 = /usr/tmp/weather.$$.rgb.1
set rgb_file2 = /usr/tmp/weather.$$.rgb.2
set USAWeatherFile = /usr/tmp/UsaWeatherMapFile.GIF

set USA_Address = '128.174.5.98'
set EUR_Address = '129.215.168.19'

set ImageDir = wx
set ImageFil = 'CVIS.GIF'
set Xzoom = '1.06'
set Yzoom = '1.7'
set FTPAddress = $USA_Address

#
# Usage.
#
if ($#argv == 0) then
  echo 
  echo $NameOfThisScript":"
  echo "A script to paint the root background to the current weather map."
  echo 
  echo "Usage: $NameOfThisScript [options]"
  echo
  echo "-usa : Uses current map of USA"
  echo
  echo "-europe : Uses current map of europe "
  echo
  echo "-query : Does a dir on the current USA weather map file"
  echo
  echo "-getUSA : Downloads and stores current USA map in $USAWeatherFile"
  echo
  echo "-paintUSA : Pastes $USAWeatherFile to root window"
  echo
  echo "any other character : same as -usa option"
  echo
  exit 1
endif

onintr cleanup

#
# Extract parameters from command line
#
set I=1
while ($I <=  $#argv)

   if ("$argv[$I]" == '-usa') then
      goto USA_Label
   else if ("$argv[$I]" == '-europe') then
      set ImageDir = 'images/gifs'
      set ImageFil = 'eur.vis.gif'
      set Xzoom = '2.048'
      set Yzoom = '3.271'
      set FTPAddress = $EUR_Address
      goto EUROPE_Label
   else if ("$argv[$I]" == '-query') then
      goto QUERY_USA_Label
   else if ("$argv[$I]" == '-getUSA') then
      goto GET_USA_Label
   else if ("$argv[$I]" == '-paintUSA') then
      goto PAINT_USA_Label
   else
      goto USA_Label
   endif

 @ I = $I + 1
end

#
# USA
#
USA_Label:
echo USA: 
cat > $infile << END
user anonymous
cd $ImageDir
binary
get $ImageFil $gif_file
bye
END
echo .......... Trying $FTPAddress for $ImageFil
ftp -n $FTPAddress < $infile
echo .......... Converting $ImageFil to rgb format
fromgif $gif_file $rgb_file1
echo .......... Zooming $rgb_file1 to $rgb_file2
izoom $rgb_file1 $rgb_file2 $Xzoom $Yzoom
echo .......... Painting Root Window
bgpaste -t 0 0 0 $rgb_file2
sleep 15
goto cleanup


#
# Query USA map.
#
QUERY_USA_Label:
echo QUERY_USA: 
cat > $infile << END
user anonymous
cd $ImageDir
dir $ImageFil
bye
END
echo
echo .......... Doing a dir on $ImageFil
echo
ftp -n $FTPAddress < $infile
goto cleanup


#
# Get USA map.
#
GET_USA_Label:
echo GET_USA: 
cat > $infile << END
user anonymous
cd $ImageDir
binary
get $ImageFil $gif_file
bye
END
ftp -n $FTPAddress < $infile
cp $gif_file $USAWeatherFile
echo
echo .......... Downloaded $ImageFil as $USAWeatherFile
echo
goto cleanup


#
# Paste USA map.
#
PAINT_USA_Label:
echo PAINT_USA: 
if ( -f $USAWeatherFile ) then
  fromgif $USAWeatherFile $rgb_file1
  izoom $rgb_file1 $rgb_file2 $Xzoom $Yzoom
  echo .......... Painting Root Window
  bgpaste -t 0 0 0 $rgb_file2
  sleep 15
  goto cleanup
else
  echo
  echo .......... $USAWeatherFile not found
  echo
  exit
endif

#
# EUROPE
#
echo EUROPE:
EUROPE_Label:
cat > $infile << END
user anonymous
login $USER@$HOST
cd $ImageDir
binary
get $ImageFil $gif_file
bye
END
echo .......... Trying $FTPAddress for $ImageFil
ftp -n $FTPAddress < $infile
echo .......... Converting $ImageFil to rgb format
fromgif $gif_file $rgb_file1
echo .......... Zooming $rgb_file1 to $rgb_file2
izoom $rgb_file1 $rgb_file2 $Xzoom $Yzoom
echo .......... Painting Root Window
bgpaste -t 0 0 0 $rgb_file2
sleep 15
goto cleanup


cleanup:


	if ( -f $infile ) then
		rm -f $infile
	endif

	if ( -f $gif_file ) then
		rm -f $gif_file
		echo .......... Cleaning up
	endif

	if ( -f $rgb_file1 ) then
		rm -f $rgb_file1
	endif

	if ( -f $rgb_file2 ) then
		rm -f $rgb_file2
		echo 
		echo .......... So how is the weather'?'
		echo 
	endif