mirror of
https://github.com/mbirth/wiki.git
synced 2024-12-27 23:24:06 +00:00
455 lines
9.7 KiB
Markdown
455 lines
9.7 KiB
Markdown
---
|
|
title: XPlanet
|
|
layout: default
|
|
created: 2009-02-17 09:24:01 +0100
|
|
updated: 2012-02-15 15:10:04 +0100
|
|
toc: false
|
|
tags:
|
|
- know-how
|
|
- software
|
|
- linux
|
|
- xplanet
|
|
---
|
|
XPlanet renders an Earth globe including actual clouds and satellites' positions. It also has data to render the moon,
|
|
mars or the sun. You can even put the image on your Desktop so that it shows the current Earth view from space instead
|
|
of a boring wallpaper.
|
|
|
|
To make things a bit easier, there's [this Python script](http://ubuntuforums.org/showpost.php?s=dba5c223bddb4c7d1e119ad00225548d&p=258035&postcount=6)
|
|
which handles downloading new cloudmaps and updating the image. I re-wrote that thing to pure Bash:
|
|
|
|
|
|
handle-xplanet.sh
|
|
=================
|
|
|
|
{% highlight bash %}
|
|
#!/bin/sh
|
|
|
|
# Script for using xplanet in Gnome
|
|
# made after http://ubuntuforums.org/showpost.php?p=259290&postcount=10
|
|
|
|
# XPlanet configuration
|
|
BODY="-body earth -latitude 52.51667 -longitude 13.41667"
|
|
SCREEN="-geometry 2560x1024 -center +1920+512 -radius 75"
|
|
STARS="-starmap /usr/share/xplanet/stars/BSC -marker_file /usr/share/xplanet/markers/brightStars -arc_file /usr/share/xplanet/arcs/constellations"
|
|
|
|
# other configuration
|
|
TMPDIR="/tmp"
|
|
PREFIX="xplanet-"
|
|
ORIGINAL="${TMPDIR}/${PREFIX}original.png"
|
|
OPTIONS="-config /opt/xplanet/xplanet.conf $BODY $SCREEN $STARS -ephemeris_file ephemeris/unxp1800.406"
|
|
TIMING="-wait 300 -hibernate 600"
|
|
|
|
if [ $# -gt 0 ]; then
|
|
# Update data
|
|
./update-cloudmap.sh
|
|
./update-satellites.sh
|
|
|
|
# Update picture
|
|
for f in ${TMPDIR}/${PREFIX}background-*.png; do
|
|
rm $f
|
|
done
|
|
TIME=`date +"%s"`
|
|
BGFILE="${TMPDIR}/${PREFIX}background-${TIME}.png"
|
|
mv $ORIGINAL $BGFILE
|
|
# set background picture
|
|
gconftool-2 -t str -s /desktop/gnome/background/picture_filename ""
|
|
sleep 1
|
|
gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$BGFILE"
|
|
# following line is for Compiz
|
|
# dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/cube/screen0/backgrounds org.freedesktop.compiz.set array:string:"$BGFILE"
|
|
else
|
|
# Initialize
|
|
/usr/bin/nice -19 /usr/bin/xplanet $TIMING -output "$ORIGINAL" $OPTIONS -post_command "/opt/xplanet/handle-xplanet.sh update"
|
|
fi
|
|
{% endhighlight %}
|
|
|
|
This script makes use of the following two helper scripts.
|
|
|
|
|
|
update-cloudmap.sh
|
|
==================
|
|
|
|
{% highlight bash %}
|
|
#!/bin/sh
|
|
|
|
CLOUDFILE="clouds.jpg"
|
|
URLLIST="update-cloudmap.lst"
|
|
UPDATE=$((3*60*60))
|
|
|
|
URL=`head -n 2 $URLLIST | tr "\n" " "`
|
|
NOW=`date +"%s"`
|
|
MTIME=`stat -c "%Y" $CLOUDFILE`
|
|
DIFF=$((NOW - MTIME))
|
|
|
|
. ./colors.sh
|
|
|
|
echo "${BOLD}Cloudmap$NORMAL is $BOLD$BLUE$DIFF$NORMAL seconds old (outdated after $UPDATE)."
|
|
|
|
DOUPDATE=0
|
|
if [ ! -e $CLOUDFILE ]; then
|
|
echo "$BOLD${RED}File not found.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ $DIFF -ge $UPDATE ]; then
|
|
echo "$BOLD${YELLOW}File is outdated.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ "$1" = "-f" ]; then
|
|
echo "$BOLD${GREEN}Update forced.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ $DOUPDATE = 1 ]; then
|
|
aria2c $URL --allow-overwrite=true -o $CLOUDFILE
|
|
{% endhighlight %}
|
|
|
|
|
|
This one reads the URL to download from a file `update-cloudmap.lst`:
|
|
|
|
~~~
|
|
http://userpage.fu-berlin.de/~jml/clouds_4096.jpg
|
|
http://www.ruwenzori.net/earth/clouds_4096.jpg
|
|
http://www.narrabri.atnf.csiro.au/operations/NASA/clouds_4096.jpg
|
|
http://userpage.fu-berlin.de/~jml/clouds_2048.jpg
|
|
http://rcswww.urz.tu-dresden.de/~es179238/clouds_2048.jpg
|
|
http://xplanet.dyndns.org/clouds/clouds_2048.jpg
|
|
http://www.ruwenzori.net/earth/clouds_2048.jpg
|
|
http://xplanet.arculeo.com/clouds_2048.jpg
|
|
http://xplanet.sourceforge.net/clouds/clouds_2048.jpg
|
|
ftp://mirror.pacific.net.au/xplanet/clouds_2048.jpg
|
|
http://www.narrabri.atnf.csiro.au/operations/NASA/clouds_2048.jpg
|
|
http://home.megapass.co.kr/~gitto88/cloud_data/clouds_2048.jpg
|
|
http://home.megapass.co.kr/~holywatr/cloud_data/clouds_2048.jpg
|
|
http://home.megapass.co.kr/~ysy00/cloud_data/clouds_2048.jpg
|
|
http://user.chol.com/~winxplanet/cloud_data/clouds_2048.jpg
|
|
ftp://ftp.iastate.edu/pub/xplanet/clouds_2048.jpg
|
|
http://xplanet.explore-the-world.net/clouds_2048.jpg
|
|
~~~
|
|
|
|
|
|
update-satellites.sh
|
|
====================
|
|
|
|
{% highlight bash %}
|
|
#!/bin/sh
|
|
|
|
TLEFILE="satellites/iss+.tle"
|
|
UPDATE=$((12*60*60))
|
|
|
|
FILES="stations.txt science.txt"
|
|
BASEURL="http://www.celestrak.com/NORAD/elements/"
|
|
NOW=`date +"%s"`
|
|
MTIME=`stat -c "%Y" $TLEFILE`
|
|
DIFF=$((NOW - MTIME))
|
|
|
|
URLS=""
|
|
for f in $FILES; do
|
|
URLS="$URLS $BASEURL$f"
|
|
done
|
|
|
|
. ./colors.sh
|
|
|
|
echo "${BOLD}Satellite$NORMAL data is $BOLD$BLUE$DIFF$NORMAL seconds old (outdated after $UPDATE)."
|
|
|
|
DOUPDATE=0
|
|
if [ ! -e $TLEFILE ]; then
|
|
echo "$BOLD${RED}File not found.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ $DIFF -ge $UPDATE ]; then
|
|
echo "$BOLD${YELLOW}File is outdated.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ "$1" = "-f" ]; then
|
|
echo "$BOLD${GREEN}Update forced.$NORMAL"
|
|
DOUPDATE=1
|
|
fi
|
|
|
|
if [ $DOUPDATE = 1 ]; then
|
|
wget -O $TLEFILE $URLS
|
|
# aria2c $URL --allow-overwrite=true -o $TLEFILE
|
|
{% endhighlight %}
|
|
|
|
|
|
colors.sh
|
|
=========
|
|
|
|
This is a helper script which provides ANSI colors through variables.
|
|
|
|
{% highlight bash %}
|
|
#!/bin/sh
|
|
|
|
TPUT=/usr/bin/tput
|
|
NORMAL=`$TPUT sgr0`
|
|
BOLD=`$TPUT bold`
|
|
BLINK=`$TPUT blink`
|
|
RED=`$TPUT setaf 1`
|
|
GREEN=`$TPUT setaf 2`
|
|
YELLOW=`$TPUT setaf 3`
|
|
BLUE=`$TPUT setaf 4`
|
|
MAGENTA=`$TPUT setaf 5`
|
|
CYAN=`$TPUT setaf 6`
|
|
WHITE=`$TPUT setaf 7`
|
|
{% endhighlight %}
|
|
|
|
|
|
get-ephemeris.sh
|
|
================
|
|
|
|
This script has to be run only once since the ephemeris is valid for several years.
|
|
|
|
{% highlight bash %}
|
|
#!/bin/sh
|
|
|
|
wget -r ftp://ssd.jpl.nasa.gov/pub/eph/export/unix/* -P ephemeris/ --no-passive-ftp -nd -c
|
|
{% endhighlight %}
|
|
|
|
|
|
xplanet.conf
|
|
============
|
|
|
|
Finally the configuration file for XPlanet: `xplanet.conf`.
|
|
|
|
{% highlight ini %}
|
|
# This file contains options you might want to customize for each
|
|
# body. It's best to leave this file alone and modify a copy. Use the
|
|
# -config option to tell xplanet to read your copy.
|
|
|
|
[default] # Values in this section apply to all
|
|
# bodies unless overridden below.
|
|
|
|
arc_color=gray
|
|
#arc_file=
|
|
|
|
#bump_map=
|
|
bump_scale=1
|
|
|
|
cloud_gamma=1
|
|
#cloud_map=
|
|
cloud_ssec=false # true if the cloud map is from the
|
|
# University of Wisconsin Space
|
|
# Science and Engineering Center
|
|
cloud_threshold=90
|
|
|
|
color={255,255,255} # fallback color in case an image map
|
|
# isn't found
|
|
|
|
draw_orbit=false # if true, draw this body's orbit
|
|
# about its primary
|
|
|
|
grid=false
|
|
grid1=6
|
|
grid2=15
|
|
|
|
#image=
|
|
|
|
magnify=1 # draw the body as if its radius were
|
|
# magnified by this factor
|
|
|
|
marker_color=yellow
|
|
#marker_file=
|
|
#marker_font=
|
|
marker_fontsize=8
|
|
|
|
max_radius_for_label=3 # don't draw a label if the body's
|
|
# radius in pixels is more than this
|
|
|
|
min_radius_for_label=.01 # don't draw a label if the body's
|
|
# radius in pixels is less than this
|
|
|
|
min_radius_for_markers=40 # don't draw markers if the body's
|
|
# radius in pixels is less than this
|
|
|
|
#night_map=
|
|
|
|
orbit={-.5,.5,2} # extent of orbit to draw,
|
|
# {start, end, delta}, where
|
|
# start and end are in units of period
|
|
# of revolution and delta is angular
|
|
# increment in degrees to evaluate
|
|
# position
|
|
|
|
orbit_color={255,255,255} # color for the orbit
|
|
|
|
random_origin=true # Can this body be considered if
|
|
# -origin random is used?
|
|
|
|
random_target=true # Can this body be considered if
|
|
# -target random is used?
|
|
|
|
#satellite_file=
|
|
|
|
shade=30 # 0 = black, 100 = same as dayside
|
|
|
|
#specular_map=
|
|
|
|
text_color={255,0,0} # color for text (markers & body label)
|
|
|
|
twilight=6 # blend the day and night images for
|
|
# pixels within this many degrees of
|
|
# the terminator
|
|
|
|
[sun]
|
|
"Sun"
|
|
color={255,255,166}
|
|
max_radius_for_label=0 # never draw a label for the sun
|
|
shade=100 # No night side!
|
|
map=maps/sun/map.jpg
|
|
|
|
[mercury]
|
|
"Mercury"
|
|
color={100, 100, 100}
|
|
|
|
min_radius_for_label=0 # always draw a label
|
|
|
|
[venus]
|
|
"Venus"
|
|
color={161, 129, 70}
|
|
|
|
min_radius_for_label=0
|
|
|
|
[earth]
|
|
"Earth"
|
|
color={28, 82, 110}
|
|
|
|
cloud_map=clouds.jpg
|
|
bump_map=maps/earth/bump.jpg
|
|
map=maps/earth/map.jpg
|
|
night_map=maps/earth/night.jpg
|
|
|
|
# I have day and night maps of Australia centered on Alice Springs,
|
|
# which are cropped from higher resolution maps.
|
|
#map=alice_springs.png
|
|
#night_map=alice_springs_night.png
|
|
#mapbounds={-1.2,98.7107,-46.2,169.023} # lat1, lon1, lat2, lon2
|
|
|
|
#marker_file=capitals.mark
|
|
marker_file=earth
|
|
|
|
min_radius_for_label=0
|
|
|
|
satellite_file=satellites/iss+
|
|
|
|
[moon]
|
|
"Moon"
|
|
color={100, 100, 100}
|
|
map=maps/moon/map.jpg
|
|
bump_map=maps/moon/bump.jpg
|
|
marker_file=moon
|
|
|
|
[mars]
|
|
"Mars"
|
|
color={172, 123, 67}
|
|
map=maps/mars/map.jpg
|
|
min_radius_for_label=0
|
|
marker_file=mars
|
|
|
|
[phobos]
|
|
"Phobos"
|
|
|
|
[deimos]
|
|
"Deimos"
|
|
|
|
[jupiter]
|
|
"Jupiter"
|
|
color={204, 163, 133}
|
|
min_radius_for_label=0
|
|
|
|
[io]
|
|
"Io"
|
|
color={212, 182, 52}
|
|
|
|
[europa]
|
|
"Europa"
|
|
color={140, 140, 140}
|
|
|
|
[ganymede]
|
|
"Ganymede"
|
|
color={150, 150, 150}
|
|
|
|
[callisto]
|
|
"Callisto"
|
|
color={70, 70, 70}
|
|
|
|
[saturn]
|
|
"Saturn"
|
|
color={244, 199, 134}
|
|
min_radius_for_label=0
|
|
|
|
[mimas]
|
|
"Mimas"
|
|
|
|
[enceladus]
|
|
"Enceladus"
|
|
|
|
[tethys]
|
|
"Tethys"
|
|
|
|
[dione]
|
|
"Dione"
|
|
|
|
[rhea]
|
|
"Rhea"
|
|
|
|
[titan]
|
|
"Titan"
|
|
|
|
color={252,94,7}
|
|
|
|
[hyperion]
|
|
"Hyperion"
|
|
|
|
[iapetus]
|
|
"Iapetus"
|
|
|
|
[phoebe]
|
|
"Phoebe"
|
|
|
|
[uranus]
|
|
"Uranus"
|
|
|
|
color={105, 197, 238}
|
|
|
|
min_radius_for_label=0
|
|
|
|
[miranda]
|
|
"Miranda"
|
|
|
|
[ariel]
|
|
"Ariel"
|
|
|
|
[umbriel]
|
|
"Umbriel"
|
|
|
|
[titania]
|
|
"Titania"
|
|
|
|
[oberon]
|
|
"Oberon"
|
|
|
|
[neptune]
|
|
"Neptune"
|
|
color={95, 133, 232}
|
|
|
|
min_radius_for_label=0
|
|
|
|
[triton]
|
|
"Triton"
|
|
|
|
[nereid]
|
|
"Nereid"
|
|
|
|
[pluto]
|
|
"Pluto"
|
|
color={206, 180, 153}
|
|
|
|
min_radius_for_label=0
|
|
|
|
[charon]
|
|
"Charon"
|
|
{% endhighlight %}
|