Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
XPlanet: Stitching your own cloud images with mosaic_clouds
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Wed Jul 31, 2002 4:05 pm    Post subject: XPlanet: Stitching your own cloud images with mosaic_clouds Reply with quote

So you use XPlanet but want to be able to download weather images and create your own clouds file? Well thanks to my buddy and forum user n0n, I will tell you how. The code for mosaic_clouds.cc is at the bottom of this post.

First you need to have the xplanet source unpacked:
Code:
ebuild /usr/portage/x11-misc/xplanet/xplanet-0.94.ebuild unpack


Then go into the working directory:
Code:
cd /var/tmp/portage/xplanet-0.94/work/xplanet-0.94


For the instructions I'll quote n0n from another really slow forum:
n0n wrote:

For UNIX people who want to run the mosaic_clouds program, first get the source, then download the GNU Scientific Library (there's a URL near the top of mosaic_clouds.cc in the comments), and install that. Oh, and also compile XPlanet from source (or at least the stuff in the "libimage" directory).

Now, when libimage was compiled, it detected a number of image libraries on your system, like libjpeg, libtiff, libungif, etc. It looks like you'll have to link in the same image libraries that libimage was compiled with. So if all you had on your system was libtiff, that's the only one you'd have to use. Me, I had lots. You can find out which libraries it found pretty easily by looking in the "libimage" directory and looking at which ".o" files were created during the compilation process. Or, go into the libimage directory and type "ar t libimage.a" to look inside the libimage archive file, that'll tell you without a doubt which image libraries you'll need.

When you're compiling, make sure to link in the GSL libraries, all the image libraries you need, and Xi (one of the libraries that comes with X11). Not sure exactly why the program needs to know about X, but it does. I use two lines to compile it (assuming that mosaic_clouds.cc was put in the root of the Xplanet tree). First, create the object file for the ".cc" file:

Code:
c++ -c -o mosaic_clouds.o mosaic_clouds.cc


Then, do the final linking:
Code:
c++ -o mosaic_clouds mosaic_clouds.o libimage/libimage.a -lgsl -lgslcblas \
    -ltiff -lpnm -lpng -ljpeg -lungif -L/usr/X11R6/lib -lXi


So then if that worked, you've got a binary named "mosaic_clouds". Note that if, for whatever reason, you don't have an executable called "c++" on your system, you can usually just use "gcc" and add in "-lstc++" to your includes, and things will typically work okay.

Now you've (hopefully) got the binary, called "mosaic_clouds." You'll probably want to copy it to wherever the "xplanet" binary got copied (usually /usr/local/bin). Here's the script I use to download the cloud images and put everything together (the downloaded cloud images are all at 1600x1200, I think, so if you've got the resolution for it, feel free to change the resolution values I've used in there; they'll scale very well. I just happen to be stuck on 1024x786 right now):

Code:
#!/bin/sh

if [ ! -f /tmp/.X0-lock -o -f /tmp/xplanet.lock -o "`netup`" = "no" ]; then
  exit
fi

touch /tmp/xplanet.lock
cd /usr/share/xplanet/periodic
wget -q -O GEIR.JPG http://www.sat.dundee.ac.uk/pdus/EI/latest_n.jpg
wget -q -O GIIR.JPG http://www.sat.dundee.ac.uk/pdus/XI/latest_n.jpg
wget -q -O GWIR.JPG http://www.sat.dundee.ac.uk/pdus/WI/latest_n.jpg
wget -q -O GGIR.JPG http://www.sat.dundee.ac.uk/pdus/JI/latest_n.jpg
wget -q -O GMIR.JPG http://www.sat.dundee.ac.uk/pdus/AI/latest2_n.jpg
mosaic_clouds -h 786 -w 1024 -o clouds_1024.png
DISPLAY=:0 xplanet -root -projection orthographic -body Earth \
    -cloud_image /usr/share/xplanet/periodic/clouds_1024.png \
    -blend -longitude -87.65 -latitude 41.85
rm /tmp/xplanet.lock


I have this script run every hour out of my crontab, and also inside my ".xinitrc", so when I start up X it'll start over with a fresh image. I did the stuff with the "xplanet.lock" so that if I started up X right when the crontab entry started, I wouldn't have to worry about two of these running at the same time. I also have it check to see if I'm actually inside X, because it doesn't make much sense otherwise. "netup" is a little script I wrote that makes sure that the 'net connection is up (it's on a laptop, so occasionally it's not), in which case I don't want to try and download the images. It's pretty simple (but it'll likely have to be modified if you're running on a non-Debian system. I know a lot of distributions have different ways of organizing things. If all else fails, you could always take a look at the output from "/sbin/ifconfig eth0" instead.):

Code:
if [ "`grep -c eth0 /etc/network/ifstate`" = "0" ]; then
  echo "no"
else
  echo "yes"
fi


So, um, yeah. That's about it, really. :P


Update: The mosaic_clouds.cc is available from the project page at Sourceforge, so get it from http://xplanet.sourceforge.net/mosaic_clouds.cc Thanks to n0n for pointing that out. Don't know why I didn't think it was available. I probably got from there in the first place.

Hopefully I've copied and pasted everything correctly and tried to account for all the steps.


Last edited by rizzo on Wed Jul 31, 2002 4:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
n0n
Guru
Guru


Joined: 13 Jun 2002
Posts: 355

PostPosted: Wed Jul 31, 2002 4:22 pm    Post subject: Reply with quote

Hey, rizzo. :) Also of note, if you don't feel like copy-and-pasting the source for mosaic_clouds.cc, you should be able to download it at http://xplanet.sourceforge.net/mosaic_clouds.cc, too. You know, we could make an ebuild of GSL and then add it in as an option to the Xplanet ebuild. That'd be pretty fun. Mayhaps I'll do that tonight.
Back to top
View user's profile Send private message
n0n
Guru
Guru


Joined: 13 Jun 2002
Posts: 355

PostPosted: Wed Jul 31, 2002 4:27 pm    Post subject: Reply with quote

Or, *ahem*, we could just use the existing GSL ebuild. DOH!
Back to top
View user's profile Send private message
hari
n00b
n00b


Joined: 28 Aug 2002
Posts: 3

PostPosted: Wed Aug 28, 2002 11:29 pm    Post subject: mosaic_clouds Reply with quote

Hi there - I'm the author of xplanet and I just found this thread. I would rather that you not package up the mosaic_clouds program. I suspect the reason for the cloud image corruption is that too many people are trying to download the image, and making mosaic_clouds available as a package will just shift the problem to the University of Dundee servers. If they start getting thousands of hits an hour, I can see them getting pissed off at the extra bandwidth and not making their satellite images available at all.

What is really needed are mirror sites for the cloud image.
Back to top
View user's profile Send private message
n0n
Guru
Guru


Joined: 13 Jun 2002
Posts: 355

PostPosted: Thu Aug 29, 2002 12:26 am    Post subject: Reply with quote

Howdy! Well, I hadn't gotten around to wrapping that up into the ebuild, and at your request I won't make the effort now. Mirrors would certainly be a good idea. Do you have any stats about how much bandwidth the cloud images are consuming on sourceforge? I wonder how busy the U. of Dundee servers are, too. It would certainly be a shame to have the images pulled off the web. If you'd rather talk via email, I could send it to you.

Oh, and thanks for the excellent program, too!
Back to top
View user's profile Send private message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Thu Aug 29, 2002 1:59 am    Post subject: Reply with quote

I'd like to echo n0n's thoughts on the great program, and sympathies for those getting bombarded by image requests.

I'd love to mirror if I had anything more than a DSL connection. Should I contact you via email if I find a steady server to make available as an image mirror?
Back to top
View user's profile Send private message
hari
n00b
n00b


Joined: 28 Aug 2002
Posts: 3

PostPosted: Thu Aug 29, 2002 3:02 pm    Post subject: mosaic_clouds Reply with quote

Thanks for understanding! I don't have any statistics on how often the cloud images are downloaded. The latest version of xplanet has around 20000 downloads, so I would guess conservatively that there are 10000 downloads per day, and the cloud image is about 400K.

So yeah, if you find any good candidates for mirror sites, please let me know.
Back to top
View user's profile Send private message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Thu Sep 05, 2002 6:51 pm    Post subject: Reply with quote

I've emailed the maintainers at mirror.sit.wisc.edu. UW is my alma mater, not that it will have any influence on things. Anyway SIT mirrors kernel and linux distros, so they are definitely in the mirroring business.

I'll let you know what I hear back.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum