Howto: Use xplanet for a desktop weather map

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

I found xplanet the other day because … well, I forget why. But I tinkered with it yesterday and came up with a fairly interesting use for it. (Actually I didn’t really come up with it. It’s more or less hinted at on the xplanet home page, but I’ll put all the steps here for you.)

That’s a satellite cloud map for the northeastern part of the globe, around 6 p.m. on Friday, July 25. The cloud patterns were superimposed on on the globe by xplanet, which oriented itself so Tokyo is directly at the center. I have enough of an angle on the planet that I can see weather coming in from China and the Koreas, and typhoon systems coming up from the Phillippines and Taiwan, which is important this time of year.

The night-and-day shadow is updated every 30 minutes, and the cloud map refreshes every three hours and on each boot. The rendering itself is somewhat processor intensive, but aside from that, the system drag is dependent on how often you want the image to update.

Since xplanet comes with a standard earth map for night and day, the entire setup really only relies on your settings. Trigger xplanet like this:

xplanet -latitude 40 -longitude 139 -radius 75 -quality 100 -geometry 1600x1200 -fork -wait 1800 -config config

The latitude and longitude numbers should be fairly obvious — those are the general coordinates for Tokyo. Replace those with the location you prefer.

The radius command zooms the map in close enough to give a better angle on my location. The setting is generally 50, which is the distance from the top of the screen to the center. In other words, the radius of the planet is 50 percent of the height of the screen. Setting it to more causes part of the planet to be cut off, like in the screenshot. Mess with that and see what you like.

Quality is a quality setting of course, and roughly corresponds to JPEG compression settings, like in the GIMP. I set it at 100 just because I happen to like my wallpaper to have some detail.

Geometry matches the screen dimensions. I set that because I don’t care to have an outsized image rendered, then resized to fit the screen. Might as well do it all in one step.

The wait command tells xplanet to pause for 1800 seconds — 30 minutes, give or take. I see no point in rerendering the map any more frequently than that. -fork sends it to a background process, independent of a terminal. Finally, the config file, where some more important settings lie.

In Crux, the default configuration file is at /usr/share/xplanet/config, which you can copy to ~/.xplanet/ and modify from there. Here’s the only line I changed:


There’s plenty more in there you can change; just as an example, uncommenting the marker file setting for earth gives you city labels everywhere on your planet.

So there’s only one other small trick that needs to be set, and that’s a fresh cloud map. The xplanet home page talks at length about cloud maps (and maps for other planets too), but the long and short of it is this Python script and this command:

python /home/kmandla/.xplanet/clouds_2048.jpg

The script searches mirrors for a fresh map, and sends it to the .xplanet/ directory. The config file passes it to the xplanet process, and the entire trick is complete.

Almost. That map is refreshed every three hours, so while it’s convenient to rerender the globe, we’ll need a fresh cloud map every now and again. The obvious way to solve that problem is with cron, and if you decide you want to go that route, I leave it to you to set it up. It doesn’t take much effort.

I decided to leave that out, only because I don’t usually have the machine on for much longer than an hour or so without rebooting — or it’s on overnight, and I don’t need to refresh it. Take your pick.

Adding both of those commands, in sequence, to your .xinitrc file gives you a fresh weather map at each X startup (or boot). Of course, you might have already sniffed out a little problem.

There’s a considerable delay between when X starts, and when the first map appears on the background. Of course, that delay is going to depend on the settings and your system speed; on mine it’s about ten seconds or so.

Which means you’ll be staring at the awful default hash pattern for a little while. I haven’t actually bothered to fix this yet, but my suggestion is to rewrite the xplanet command to output the image to a file instead of directly to the window.

Then you can use something like feh to actually paint the image to the background, and additionally you can trigger feh on startup to put up the old map, and let xplanet draw a new one. When it’s done, trigger feh again, this time to apply the new image.

That’s about it. There are other ways and other applications that can do this, but xplanet is really very cool; it does a lot more than just draw wimpy weather maps. Take the time to learn all the ins and outs and you’ll be making some very cool background images. Check the xplanet home page for some more screenshots.


4 thoughts on “Howto: Use xplanet for a desktop weather map

  1. Pingback: newslife site » linux user podcast 80

  2. Pingback: Things to do with an old computer « Motho ke motho ka botho

  3. Pingback: One mine, one not « Motho ke motho ka botho

  4. Pingback: The geeky details: Clock and weather map « Motho ke motho ka botho

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s