Shallow Thoughts : : science

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Thu, 31 Jul 2014

Predicting planetary visibility with PyEphem

Part II: Predicting Conjunctions

After I'd written a basic script to calculate when planets will be visible, the next step was predicting conjunctions, times when two or more planets are close together in the sky.

Finding separation between two objects is easy in PyEphem: it's just one line once you've set up your objects, observer and date.

p1 = ephem.Mars()
p2 = ephem.Jupiter()
observer = ephem.Observer()  # and then set it to your city, etc.
observer.date = ephem.date('2014/8/1')
p1.compute(observer)
p2.compute(observer)

ephem.separation(p1, p2)

So all I have to do is loop over all the visible planets and see when the separation is less than some set minimum, like 4 degrees, right?

Well, not really. That tells me if there's a conjunction between a particular pair of planets, like Mars and Jupiter. But the really interesting events are when you have three or more objects close together in the sky. And events like that often span several days. If there's a conjunction of Mars, Venus, and the moon, I don't want to print something awful like

Friday:
  Conjunction between Mars and Venus, separation 2.7 degrees.
  Conjunction between the moon and Mars, separation 3.8 degrees.
Saturday:
  Conjunction between Mars and Venus, separation 2.2 degrees.
  Conjunction between Venus and the moon, separation 3.9 degrees.
  Conjunction between the moon and Mars, separation 3.2 degrees.
Sunday:
  Conjunction between Venus and the moon, separation 4.0 degrees.
  Conjunction between the moon and Mars, separation 2.5 degrees.

... and so on, for each day. I'd prefer something like:

Conjunction between Mars, Venus and the moon lasts from Friday through Sunday.
  Mars and Venus are closest on Saturday (2.2 degrees).
  The moon and Mars are closest on Sunday (2.5 degrees).

At first I tried just keeping a list of planets involved in the conjunction. So if I see Mars and Jupiter close together, I'd make a list [mars, jupiter], and then if I see Venus and Mars on the same date, I search through all the current conjunction lists and see if either Venus or Mars is already in a list, and if so, add the other one. But that got out of hand quickly. What if my conjunction list looks like [ [mars, venus], [jupiter, saturn] ] and then I see there's also a conjunction between Mars and Jupiter? Oops -- how do you merge those two lists together?

The solution to taking all these pairs and turning them into a list of groups that are all connected actually lies in graph theory: each conjunction pair, like [mars, venus], is an edge, and the trick is to find all the connected edges. But turning my list of conjunction pairs into a graph so I could use a pre-made graph theory algorithm looked like it was going to be more code -- and a lot harder to read and less maintainable -- than making a bunch of custom Python classes.

I eventually ended up with three classes: ConjunctionPair, for a single conjunction observed between two bodies on a single date; Conjunction, a collection of ConjunctionPairs covering as many bodies and dates as needed; and ConjunctionList, the list of all Conjunctions currently active. That let me write methods to handle merging multiple conjunction events together if they turned out to be connected, as well as a method to summarize the event in a nice, readable way.

So predicting conjunctions ended up being a lot more code than I expected -- but only because of the problem of presenting it neatly to the user. As always, user interface represents the hardest part of coding.

The working script is on github at conjunctions.py.

Tags: , , ,
[ 19:57 Jul 31, 2014    More science/astro | permalink to this entry | comments ]

Wed, 23 Jul 2014

Predicting planetary visibility with PyEphem

Part 1: Basic Planetary Visibility

All through the years I was writing the planet observing column for the San Jose Astronomical Association, I was annoyed at the lack of places to go to find out about upcoming events like conjunctions, when two or more planets are close together in the sky. It's easy to find out about conjunctions in the next month, but not so easy to find sites that will tell you several months in advance, like you need if you're writing for a print publication (even a club newsletter).

For some reason I never thought about trying to calculate it myself. I just assumed it would be hard, and wanted a source that could spoon-feed me the predictions.

The best source I know of is the RASC Observer's Handbook, which I faithfully bought every year and checked each month so I could enter that month's events by hand. Except for January and February, when I didn't have the next year's handbook yet by the time my column went to press and I was on my own. I have to confess, I was happy to get away from that aspect of the column when I moved.

In my new town, I've been helping the local nature center with their website. They had some great pages already, like a What's Blooming Now? page that keeps track of which flowers are blooming now and only shows the current ones. I've been helping them extend it by adding features like showing only flowers of a particular color, separating the data into CSV databases so it's easier to add new flowers or butterflies, and so forth. Eventually we hope to build similar databases of birds, reptiles and amphibians.

And recently someone suggested that their astronomy page could use some help. Indeed it could -- it hadn't been updated in about five years. So we got to work looking for a source of upcoming astronomy events we could use as a data source for the page, and we found sources for a few things, like moon phases and eclipses, but not much.

Someone asked about planetary conjunctions, and remembering how I'd always struggled to find that data, especially in months when I didn't have the RASC handbook yet, I got to wondering about calculating it myself. Obviously it's possible to calculate when a planet will be visible, or whether two planets are close to each other in the sky. And I've done some programming with PyEphem before, and found it fairly easy to use. How hard could it be?

Note: this article covers only the basic problem of predicting when a planet will be visible in the evening. A followup article will discuss the harder problem of conjunctions.

Calculating planet visibility with PyEphem

The first step was figuring out when planets were up. That was straightforward. Make a list of the easily visible planets (remember, this is for a nature center, so people using the page aren't expected to have telescopes):

import ephem

planets = [
    ephem.Moon(),
    ephem.Mercury(),
    ephem.Venus(),
    ephem.Mars(),
    ephem.Jupiter(),
    ephem.Saturn()
    ]

Then we need an observer with the right latitude, longitude and elevation. Elevation is apparently in meters, though they never bother to mention that in the PyEphem documentation:

observer = ephem.Observer()
observer.name = "Los Alamos"
observer.lon = '-106.2978'
observer.lat = '35.8911'
observer.elevation = 2286  # meters, though the docs don't actually say

Then we loop over the date range for which we want predictions. For a given date d, we're going to need to know the time of sunset, because we want to know which planets will still be up after nightfall.

observer.date = d
sunset = observer.previous_setting(sun)

Then we need to loop over planets and figure out which ones are visible. It seems like a reasonable first approach to declare that any planet that's visible after sunset and before midnight is worth mentioning.

Now, PyEphem can tell you directly the rising and setting times of a planet on a given day. But I found it simplified the code if I just checked the planet's altitude at sunset and again at midnight. If either one of them is "high enough", then the planet is visible that night. (Fortunately, here in the mid latitudes we don't have to worry that a planet will rise after sunset and then set again before midnight. If we were closer to the arctic or antarctic circles, that would be a concern in some seasons.)

min_alt = 10. * math.pi / 180.
for planet in planets:
    observer.date = sunset
    planet.compute(observer)
    if planet.alt > min_alt:
        print planet.name, "is already up at sunset"

Easy enough for sunset. But how do we set the date to midnight on that same night? That turns out to be a bit tricky with PyEphem's date class. Here's what I came up with:

    midnight = list(observer.date.tuple())
    midnight[3:6] = [7, 0, 0]
    observer.date = ephem.date(tuple(midnight))
    planet.compute(observer)
    if planet.alt > min_alt:
        print planet.name, "will rise before midnight"

What's that 7 there? That's Greenwich Mean Time when it's midnight in our time zone. It's hardwired because this is for a web site meant for locals. Obviously, for a more general program, you should get the time zone from the computer and add accordingly, and you should also be smarter about daylight savings time and such. The PyEphem documentation, fortunately, gives you tips on how to deal with time zones. (In practice, though, the rise and set times of planets on a given day doesn't change much with time zone.)

And now you have your predictions of which planets will be visible on a given date. The rest is just a matter of writing it out into your chosen database format.

In the next article, I'll cover planetary and lunar conjunctions -- which were superficially very simple, but turned out to have some tricks that made the programming harder than I expected.

Tags: , , ,
[ 21:32 Jul 23, 2014    More science/astro | permalink to this entry | comments ]

Sat, 07 Sep 2013

Daytime Venus-Moon-Saturn conjunction

Tomorrow, Sunday September 8th, is an interesting astronomical event: a nice conjunction of a slim crescent moon and gibbous Venus, with Saturn hanging above and to the left of the pair.

That alone isn't anything unusual, though they'll be a lovely naked-eye sight just after nightfall. But here's the kicker: they'll be quite a bit closest during the daytime, best around 2-3 in the afternoon, Which makes for a fun exercise: can you find the crescent moon during daylight, then use it to guide you to Venus (right above it, about a degree away) and Saturn (about 10 degrees away, down and left)?

They'll be just a little east of due south, and about 40 degrees up. You'll definitely need binoculars to find Saturn, and they might help in finding the other two as well, depending on how bright and how hazy your afternoon sky is. Once you find them, a low powered telescope view should show Venus' phase and Saturn's rings. Venus is gibbous, alas; it would have been fun to see two crescents lined up one above the other.

If you have trouble finding them, wait until 3:30 pm, when they'll be transiting. At that point, you should be able to point due south, sweep your binoculars (or just your eyes) up just short of halfway to the zenith, and the moon should be there.

If you don't get a chance to watch the daylight conjunction, or don't have binoculars or a telescope handy, at least take a naked eye look at the trio at nightfall.

Mars and an early view of Comet ISON

As long as I'm reposting tips from my SJAA Ephemeris Shallow Sky column, there's another interesting thing in the sky this month: Comet C/2012 S1 ISON. Yes, that's the "super comet" that's supposed to become brighter than the moon. No, it won't be bright yet. It's still super wimpy, and worse, it's still in the morning sky, so it's not an easy or convenient target.

On the other hand, through September and October, Mars and Comet ISON will be within a few degrees of each other. So if you're willing to stay up (or get up) for early morning dark-sky observing, and you have a big telescope, this could be a nice view.

The comet won't be very impressive yet -- it's only expected to be 10th magnitude in September -- but such close proximity to Mars makes it easy to find and keep track of. In September, the pair don't rise until about 3:30am, and that won't change much for the next few months. The comet will probably stay below naked eye visibility at least for the next two months, brightening from 11th magnitude in early September to maybe 7th magnitude by Halloween.

As September opens, ISON makes a triangle with Mars and M44, the Beehive cluster. The comet stands about 2 degrees north of the Beehive and about 5 degrees east of Mars. But it closes with Mars as the month progresses: by the end of September you can find the comet about two degrees north of Mars, and by the middle of October they'll be down to only a degree apart (with ISON brightening to about ninth magnitude).

About that Beehive cluster: right now (September 7 through 9), Mars is passing right through the Beehive, like an angry red wasp among the smaller bees. Should be a nice view even if the comet isn't. It's a good binocular or even naked eye view (though great with a telescope, too). So if you find yourself up before dawn, definitely take a look.

Tags:
[ 19:34 Sep 07, 2013    More science/astro | permalink to this entry | comments ]

Wed, 03 Jul 2013

Mad Moon Models

[This a slight revision of my monthly "Shallow Sky" column in the SJAA Ephemeris newsletter. Looks like the Ephemeris no longer has an online HTML version, just the PDF of the whole newsletter, so I may start reposting my Ephemeris columns here more often.]

[Plate IX: The Lunar Apennines, Archemedes &c.] Last month I stumbled upon a loony moon book I hadn't seen before, one that deserves consideration by all lunar observers.

The book is The Moon: Considered as a Planet, a World, and a Satellite by James Nasmyth, C.E. and James Carpenter, F.R.A.S. It's subtitled "with twenty-six illustrative plates of lunar objects, phenomena, and scenery; numerous woodcuts &c." It was written in 1885.

Astronomers may recognize the name Nasmyth: his name is attached to a modified Cassegrain focus design used in a lot of big observatory telescopes. Astronomy was just a hobby for him, though; he was primarily a mechanical engineer. His coauthor, James Carpenter, was an astronomer at the Royal Greenwich Observatory.

The most interesting thing about their book is the plates illustrating lunar features. In 1885, photography wasn't far enough along to get good close-up photos of the moon through a telescope. But Nasmyth and Carpenter wanted to show something beyond sketches. So they built highly detailed models of some of the most interesting areas of the moon, complete with all their mountains, craters and rilles, then photographed them under the right lighting conditions for interesting shadows similar to what you'd see when that area was on the terminator.

[David North explaining the moon] I loved the idea, since I'd worked on a similar but much less ambitious project myself. Over a decade ago, before we were married, Dave North got the idea to make a 3-D model of the full moon that he could use for the SJAA astronomy class. I got drafted to help. We started by cutting a 3-foot disk of wood, on which we drew a carefully measured grid corresponding to the sections in Rukl's Atlas of the Moon. Then, section by section, we drew in the major features we wanted to incorporate. Once the drawing was done, we mixed up some spackle -- some light, and some with a little black paint in it for the mare areas -- and started building up relief on top of the features we'd sketched. The project was a lot of fun, and we use the moon model when giving talks (otherwise it hangs on the living room wall).

Nasmyth and Carpenter's models cover only small sections of the moon -- Copernicus, Plato, the Apennines -- but in amazing detail. Looking at their photos really is like looking at the moon at high magnification on a night of great seeing.

So I had to get the book. Amazon has two versions, a paperback and a hardcover. I opted for the paperback, which turns out to be scanned from a library book (there's even a scan of the pocket where the book's index card goes). Some of the scanning is good, but some of the plates come out all black. Not very satisfying.

But once I realized that an 1885 book was old enough to be public domain, I checked the web. I found two versions: one at Archive.org and one on Google Books. They're scans from two different libraries; the Archive.org scan is better, but the epub version I downloaded for my ebook reader has some garbled text and a few key plates, like Clavius, missing. The Google version is a much worse scan and I couldn't figure out if they had an epub version. I suspect the hardcover on Amazon is likely a scan from yet a fourth library.

At the risk of sounding like some crusty old Linux-head, wouldn't it be nice if these groups could cooperate on making one GOOD version rather than a bunch of bad ones?

I also discovered that the San Jose library has a copy. A REAL copy, not a scan. It gave me a nice excuse to take the glass elevator up to the 8th floor and take in the view of San Jose. And once I got it, I scanned all the moon sculpture plates myself. Sadly, like the Archive.org ebook, the San Jose copy is missing Copernicus. I wonder if vandals are cutting that page out of library copies? That makes me wince even to think of it, but I know such things happen.

Whichever version you prefer, I'd recommend that lunies get hold of a copy. It's a great introduction to planetary science, with very readable discussions of how you measure things like the distance and size of the moon. It's an even better introduction to lunar observing: if you merely go through all of their descriptions of interesting lunar areas and try to observe the features they mention, you'll have a great start on a lunar observing program that'll keep you busy for months. For experienced observers, it might give you a new appreciation of some lunar regions you thought you already knew well. Not at super-fine levels of detail -- no Alpine Valley rille -- but a lot of good discussion of each area.

[Plate XVIII: Aristarchus & Herodotus ] Other parts of the book are interesting only from a historical perspective. The physical nature of lunar features wasn't a settled issue in 1885, but Nasmyth and Carpenter feel confident that all of the major features can be explained as volcanism. Lunar craters are the calderas of enormous volcanoes; mountain ranges are volcanic too, built up from long cracks in the moon's crust, like the Cascades range in the Pacific Northwest.

There's a whole chapter on "Cracks and Radiating Streaks", including a wonderful plate of a glass ball with cracks, caused by deformation, radiating from a single point. They actually did the experiment: they filled a glass globe with water and sealed it, then "plunged it into a warm bath". The cracks that resulted really do look a bit like Tycho's rays (if you don't look TOO closely: lunar rays actually line up with the edges of the crater, not the center).

It's fun to read all the arguments that are plausible, well reasoned -- and dead wrong. The idea that craters are caused by meteorite impacts apparently hadn't even been suggested at the time.

Anyway, I enjoyed the book and would definitely recommend it. The plates and observing advice can hold their own against any modern observing book, and the rest ... is a fun historical note.

Here are some places to get it:
Amazon:

Online:

Or, try your local public library -- they might have a real copy!

Tags: , , , ,
[ 16:12 Jul 03, 2013    More science/astro | permalink to this entry | comments ]

Wed, 08 May 2013

Gamymede whac-a-moon tonight

A couple of months ago I wrote about watching an eclipse of Europa by Jupiter's shadow. It's a game I call "Whac-a-Moon", where a moon comes out from behind Jupiter, but stays there for only a short time then disappears into eclipse. If you aren't ready for it, it's gone.

This can only happen when Jupiter's shadow is offset from Jupiter that there's a gap between the planet and the shadow as seen from Earth. Jupiter is getting low in the west, and soon we'll lose it behind the sun, but tonight, Wednesday May 8, there's a decent Ganymede Whac-a-Moon opportunity for those of us on the US west coast.

Ganymede disappears behind Jupiter at 6:45 pm PDT, still during daylight. Some time around 9:43 Ganymede reappears from behind Jupiter, but it only stays visible for a couple of minutes before entering Jupiter's eclipse. Don't trust these times I'm giving you: set up at least five minutes early, preferably more than that. And set up somewhere with a good western horizon, because Jupiter will be very low, less than 8 degrees above the horizon.

You can simulate the event on my Javascript Jupiter. When the G goes blue, that means Ganymede is in eclipse. But the simulation won't show you the interesting part: how gradual the eclipse is, as the moon slides through the edge of Jupiter's shadow. During the Europa eclipse a few months ago, I wanted to record the time of disappearance so I could adjust my code accordingly, but I found I couldn't pin it down at all -- Europa started dimming almost as soon as it emerged from behind Jupiter, and kept dimming until I couldn't convince myself I saw it any more.

So far, I've only watched Europa as it slid into eclipse by Jupiter's shadow; I haven't whacked Ganymede. But Ganymede is so much larger that I suspect the slow dimming effect will be even more obvious. Unfortunately, I'm not optimistic about being able to see it myself; we've had cloudy skies here for the last few nights, and that combined with the low western horizon may do me in. I may have to wait until autumn, when Jupiter will next be visible in our evening skies. But I hope someone reading this gets a chance to see this month's eclipse.

Tags: ,
[ 11:46 May 08, 2013    More science/astro | permalink to this entry | comments ]

Tue, 12 Mar 2013

The Europa Eclipse -- results

I wrote last week about an upcoming eclipse of Europa by Jupiter's shadow. One of the interesting things I'd found was how much the predicted times of Europa's appearance from behind Jupiter, and subsequent disappearance into Jupiter's shadow, varied depending on which program you were using. I had just recently managed to get my own Javascript Jupiter page showing eclipse events, and its times didn't agree with any of the other programs either. So I was burning with curiosity to know who was right.

The predicted times were:
Europa appears Europa disappears
XEphem 7:43 7:59
S&T Jupiter's Moons 7:40 7:44
my Javascript Jupiter 7:45 7:52
Stellarium 6:49 7:05

I was out of town on March 10. I brought along a travel scope, an Orion 80mm f/6 Orion Express. Not the perfect planetary scope, but certainly enough to see Europa. (The Galilean moons are even visible in binoculars, as long as you mount the binoculars on a tripod or otherwise hold them steady.)

I synchronized my watch and had the telescope set up by 7:35. Sure enough, there was no Europa there. But at 7:38 on the dot, I saw the first hint of Europa peeking out. No question about it. I watched, and timed, and by 7:41 the whole disk of Europa was visible and I could start to think I could see blackness between it and Jupiter. I'd been to a school star party a few days earlier and hadn't cleaned my eyepieces afterward -- oops! -- so the view was a little foggy and it was hard to tell for sure exactly when Europa's disk cleared Jupiter.

In fact, no matter which eyepiece I used, the fogginess seemed to get worse and worse. I had a hard time seeing Europa at all. Finally I realized that I was looking through a tree branch, and moved the scope. But by the time I got it moved again, Europa had gotten even harder to see. That was when I realized that it had been going into eclipse practically the whole time I was watching it. It was already significantly dimmed by 7:43, very dim indeed by 7:48 and gone -- in the 80mm -- by 7:49:20, though I suspect it still would have been visible in a larger scope with clean eyepieces.

So that's why the times in different programs varied so much! Galilean moons aren't point sources: you can't predict a single time for a moon disappearance, appearance or eclipse. Do you want to predict the beginning of the event, the end of the event or the time at the moon's center point? And that goes double for eclipses, where the moon is gradually sliding into the shadow of Jupiter's atmosphere. I found that it took over seven minutes the moon to go from full brightness to fully eclipsed. So what part of that do you predict?

All in all, a very interesting observing session. I'm looking forward to observing more of these eclipses, doing more timings, and tuning my program to give better predictions. (I notice my program was significantly late on both the appearance and the eclipse. I'll work on that. Better to err on the early side, and not miss anything!)

While I was adding eclipses to my Jupiter program, I also added longer-range predictions, so it would be easier to find out when these events will happen. Once that was implemented, I looked for upcoming Whac-a-Moon events. I found one on Mar 26, when Ganymede appears at 7:29pm PDT (add 7 hours for GMT). Europa and its shadow are transiting Jupiter's disk, too, so there's plenty to look at. Ganymede then enters eclipse at 9:40pm PDT. A long time between the events, I know, but it's easy enough to leave a scope set up in the backyard and go out to check it now and then.

These times are from my Javascript Jupiter program and may be a few minutes late. Always be ready at least five minutes early in case the predictions are off, no matter which program you use. Don't say I didn't warn you.

I found no events in April visible at night in California (for other time zones, you can generate predictions on my Javascript Jupiter page). But May 8 has a decent one: Ganymede appears at 9:44pm PDT, then disappears into eclipse at 9:46. Based on what I saw tonight with Europa, that means the moon should start to fade almost immediately after it has emerged from behind Jupiter, maybe even before it has fully emerged. Ganymede's larger size may also mean the fade-out will take longer. Stay tuned. Jupiter will be very low by then, only 7 degrees above the horizon.

Not many events to observe -- this is a bit rarer than I'd thought. Of course, there are lots of moons disappearing into eclipse and appearing from out of it every night, so watching that long gradual appearance or disappearance isn't difficult; the only rare part is when they appear briefly between Jupiter and Jupiter's shadow. That is relatively rare, and I'm glad I had a chance to catch it.

Tags: ,
[ 19:55 Mar 12, 2013    More science/astro | permalink to this entry | comments ]

Sat, 09 Mar 2013

Whac-a-Moon: Watch Europa appear and disappear this Sunday

This is an edited and updated version of my "Shallow Sky" column this month in the SJAA Ephemeris newsletter.

A few months ago, I got email from a Jupiter observer calling my attention to an interesting phenomenon of Jupiter's moons that I hadn't seen before. The person who mailed me described himself as a novice, and wasn't quite sure what he had seen, but he knew it was odd. After some further discussion we pinned it down.

He was observing Jupiter at 11/11/12 at 00.25 UT (which would have been mid-afternoon here in San Jose). Three of the moons were visible, with only Ganymede missing. Then Ganymede appeared: near Jupiter's limb, but not right on it. As he watched over the next few minutes, Ganymede seemed to be moving backward -- in toward Jupiter rather than away from it. Eventually it disappeared behind the planet.

It turned out that what he was seeing was the end of an eclipse. Jupiter was still a few months away from opposition, so the shadow thrown by the planet streamed off to one side as seen from our inner-planet vantage point on Earth. At 0:26 UT on that evening, long before he started observing, Ganymede, still far away from Jupiter's limb, had entered Jupiter's shadow and disappeared into eclipse. It took over two hours for Ganymede to cross Jupiter's shadow; but at 2:36, when it left the shadow, it hadn't yet disappeared behind the planet. So it became visible again. It wasn't until 2:50 that Ganymede finally disappeared behind Jupiter.

So it was an interesting effect -- bright Ganymede appearing out of nowhere, moving in toward Jupiter then disappearing again fourteen minutes later. It was something I'd never seen, or thought to look for. It's sort of like playing Whac-a-mole -- the moon appears only briefly, so you've got to hit it with your telescope at just the right time if you want to catch it before it disappears again.

A lot of programs don't show this eclipse effect -- including, I'm sad to say, my own Javascript Jupiter's moons web page. (I have since remedied that.) The open source program Stellarium shows the effect; on the web, Sky and Telescope's Jupiter's Moons page shows it, and even prints out a table of times of various moon events, including eclipses.

[Europa eclipse on Mar 10 2013]

These eclipse events aren't all that uncommon -- but only when the sun angle is just right. Searching in late February and early March this year, I found several events for Ganymede and Europa (though, sadly, many of them were during our daytime). By mid-March, the angles have changed so that Europa doesn't leave Jupiter's shadow until after it's disappeared behind the planet's limb; but Ganymede is farther out, so we can see Ganymede appearances all the way through March and for months after.

The most interesting view, it seems to me, is right on the boundary when the moon only appears for a short time before disappearing again. Like the Europa eclipse that's happening this Sunday night, March 10.

Reporting on that one got a little tricky -- because that's the day we switch to Daylight Savings time. I have to confess that I got a little twisted up trying to compare results between programs that use UTC and programs that use local time -- especially when the time zone converter I was using to check my math told me "That time doesn't exist!" Darnit, if we'd all just use UTC all the time, astronomy calculations would be a lot easier! (Not to mention dropping the silly Daylight Savings Time fiasco, but that's another rant.)

Before I go into the details, I want to point out that Jupiter's moons are visible even in binoculars. So even if you don't have a telescope, grab binoculars and set them up in as steady a way as you can -- if you don't have a tripod adaptor, try bracing them on the top of a gate or box.

On Sunday night, March 10, at some time around 7:40 pm PDT, Europa peeks out from behind Jupiter's northeast limb. (All times are given in PDT; add 7 hours for GMT.) The sky will still be bright here in California -- the sun sets at 7:12 that night -- but Jupiter will be 66 degrees up and well away from the sun, so it shouldn't give you too much trouble. Once Europa pops out, keep a close eye on it -- because if Sky & Tel's calculations are right, it will disappear again just four minutes later, at 7:44, into eclipse in Jupiter's shadow. It will remain invisible for almost three hours, finally reappearing out of nowhere, well off Jupiter's limb, at around 10:24 pm.

Here's a link to my Javascript Jupiter just before Europa reappears.

I want to stress that those times are approximate. In fact, I tried simulating the event in several different programs, and got wildly varying times:
Io disappears Europa appears Europa disappears Europa reappears Io appears
XEphem 7:15 7:43 7:59 10:06 10:43
S&T Jupiter's Moons 7:16 7:40 7:44 10:24 10:48
Javascript Jupiter 7:17 7:45 7:52 10:15 10:41
Stellarium 6:21 6:49 7:05 9:32 10:01

You'll note Stellarium seems to have a time zone problem ... maybe because I ran the prediction while we were still in standard time, not daylight savings time.

I'm looking forward to timing the events to see which program is most accurate. I'm betting on XEphem. Once I know the real times, maybe I can adjust my Javascript Jupiter's code to be more accurate. If anyone else times the event, please send me your times, in case something goes wrong here!

Anyway, the spread of times makes it clear that when observing this sort of phenomenon, you should always set up the telescope ten or fifteen minutes early, just in case. And ten extra minutes spent observing Jupiter -- even without moons -- is certainly never time wasted! Just keep an eye out for Europa to appear -- and be ready to whack that moon before it disappears again.

Tags: , ,
[ 11:30 Mar 09, 2013    More science/astro | permalink to this entry | comments ]

Wed, 31 Oct 2012

Comparing sunset times with PyEphem

We were marveling at how early it's getting dark now -- seems like a big difference even compared to a few weeks ago. Things change fast this time of year.

Since we're bouncing back and forth a lot between southern and northern California, Dave wondered how Los Angeles days differed from San Jose days. Of course, San Jose being nearly 4 degrees farther north, it should have shorter days -- but by the weirdness of orbital mechanics that doesn't necessarily mean that the sun sets earlier in San Jose. His gut feel was that LA was actually getting an earlier sunset.

"I can calculate that," I said, and fired up a Python interpreter to check with PyEphem. Since PyEphem doesn't know San Jose (hmph! San Jose is bigger than San Francisco) I used San Francisco.

Since PyEphem's Observer class only has next_rising() and next_setting(), I had to set a start date of midnight so I could subtract the two dates properly to get the length of the day.

>>> sun = ephem.Sun()
>>> la = ephem.city('Los Angeles')
>>> sf = ephem.city('San Francisco')
>>> 
>>> mid = ephem.Date('2012/10/31 8:00')
>>> 
>>> la.next_rising(sun, start=mid)
2012/10/31 14:11:57
>>> la.next_setting(sun, start=mid)
2012/11/1 01:00:45
>>> la.next_setting(sun, start=mid) - la.next_rising(sun, start=mid)
0.45055988136300584
>>> 
>>> sf.next_rising(sun, start=mid)
2012/10/31 14:34:19
>>> sf.next_setting(sun, start=mid)
2012/11/1 01:11:44
>>> sf.next_setting(sun, start=mid) - sf.next_rising(sun, start=mid)
0.4426457611261867

So Dave's intuition was right: northern California really does have a later sunset than southern California at this time of year, even though the total day length is shorter -- the difference in sunrise time makes up for the later sunset.

How much shorter?

>>> (la.next_setting(sun, start=mid) - la.next_rising(sun, start=mid)) - (sf.next_setting(sun, start=mid) - sf.next_rising(sun, start=mid))
0.007914120236819144
>>> ((la.next_setting(sun, start=mid) - la.next_rising(sun, start=mid)) - (sf.next_setting(sun, start=mid) - sf.next_rising(sun, start=mid))) * 24
0.18993888568365946
>>> ((la.next_setting(sun, start=mid) - la.next_rising(sun, start=mid)) - (sf.next_setting(sun, start=mid) - sf.next_rising(sun, start=mid))) * 24 * 60
11.396333141019568

And we have our answer -- there's about 11 minutes difference in day length between SF and LA.

Tags: , ,
[ 11:46 Oct 31, 2012    More science/astro | permalink to this entry | comments ]

Syndicated on:
LinuxChix Live
Ubuntu Women
Women in Free Software
Graphics Planet
DevChix
Ubuntu California
Planet Openbox
Devchix
Planet LCA2009

Friends' Blogs:
Morris "Mojo" Jones
Jane Houston Jones
Dan Heller
Long Live the Village Green
Ups & Downs
DailyBBG

Other Blogs of Interest:
DevChix
Scott Adams
Dave Barry
BoingBoing

Powered by PyBlosxom.