<div dir="ltr"><div>We run into a similar problem with a project in SpaceApps.<br><br></div>I think we discarded Skycoord due to the speed so we used PyEphem.<br><div><div><br>Let me tell you in advance that I am not sure whether this works (I did not properly tested it nor had time to check it out properly).<br><br><a href="https://github.com/juanlu-sanz/neo-challege-2016/blob/master/spice/restapi.py">https://github.com/juanlu-sanz/neo-challege-2016/blob/master/spice/restapi.py</a><br><br><br></div><div>Go to line 103: <span class="gmail-pl-k">def</span> <span class="gmail-pl-en">conversion</span>(<span class="gmail-pl-smi">ar</span>,<span class="gmail-pl-smi">dec</span>,<span class="gmail-pl-smi">times_list</span>,<span class="gmail-pl-smi">lat</span>,<span class="gmail-pl-smi">lon</span>):<br><br></div><div>[<b>AGAIN</b>: I am not sure whether this works properly as we did not have time to test it!!] (and as per the coding style and so on: We did the entire thing in a weekend so, please have some mercy :-P)<br></div><div><br>obs.date<span class="gmail-pl-k">=</span>times_list[k]<span class="gmail-pl-c"></span>
<table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC112" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> <span class="gmail-pl-c1">LST</span><span class="gmail-pl-k">=</span>math.degrees(obs.sidereal_time())</td>
</tr>
<tr>
</tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC113" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> <span class="gmail-pl-c1">HA</span> <span class="gmail-pl-k">=</span> ar[k] <span class="gmail-pl-k">-</span> <span class="gmail-pl-c1">LST</span></td>
</tr>
<tr>
</tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC114" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> x <span class="gmail-pl-k">=</span> math.cos(<span class="gmail-pl-c1">HA</span>) <span class="gmail-pl-k">*</span> math.cos(dec[k])</td>
</tr>
<tr>
</tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC115" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> y <span class="gmail-pl-k">=</span> math.sin(<span class="gmail-pl-c1">HA</span>) <span class="gmail-pl-k">*</span> math.cos(dec[k])</td>
</tr>
<tr>
</tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC116" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> z <span class="gmail-pl-k">=</span> math.sin(dec[k])</td>
</tr>
<tr>
</tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC117" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"> zhor <span class="gmail-pl-k">=</span> x <span class="gmail-pl-k">*</span> math.sin(<span class="gmail-pl-c1">90</span> <span class="gmail-pl-k">-</span> lat) <span class="gmail-pl-k">+</span> z <span class="gmail-pl-k">*</span> math.cos(<span class="gmail-pl-c1">90</span> <span class="gmail-pl-k">-</span> lat)</td>
</tr>
<tr>
</tr></tbody></table> alt.append(math.asin(zhor))<br><br><br></div><div>BR<br></div><div>Fran Gallardo<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-27 11:56 GMT+01:00 Tim Cornwell <span dir="ltr"><<a href="mailto:realtimcornwell@gmail.com" target="_blank">realtimcornwell@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hi Tim,</div><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">I can see how that works bit what I want is to be able to calculate from the local hour angle i.e. a relative time (LST-RA) instead of starting with an absolute time. For context, I’m writing some simulation code and don’t need to work with absolute time. From what I see, it’s not possible in astropy to start with hour angle instead of some form of absolute time. I can work around this but it seems to be a hole in either the package or more likely in the documentation.</div><span class=""><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Thanks,</div><div id="m_2345081266322310723bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Tim</div> <br> <div id="m_2345081266322310723bloop_sign_1485514351835307008" class="m_2345081266322310723bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Tim Cornwell<br>Sent with Airmail</div></div> <br></span><div><div class="h5"><p class="m_2345081266322310723airmail_on">On 27 January 2017 at 10:51:42 am, Tim Staley (<a href="mailto:tim.staley@physics.ox.ac.uk" target="_blank">tim.staley@physics.ox.ac.uk</a>) wrote:</p> <blockquote type="cite" class="m_2345081266322310723clean_bq"><span><div><div></div><div>Hi Tim,
<br>
<br>you want something like the following:
<br>
<br> from astropy.coordinates import SkyCoord, AltAz, EarthLocation
<br>
<br> from astropy.time import Time
<br> import astropy.units as u
<br>
<br> obs_time = Time('2017-01-01T18:00')
<br>
<br> sky_posn = SkyCoord(0 * u.deg, 30 * u.deg)
<br> earth_location = EarthLocation.from_geodetic(0*<wbr>u.deg, 35*u.deg)
<br>
<br> altaz = sky_posn.transform_to(
<br> AltAz(obstime=obs_time,
<br> location=earth_location))
<br>
<br> print(altaz.alt.deg, altaz.az.deg)
<br>
<br>
<br>Cheers,
<br>Tim
<br>
<br>On 27/01/17 10:34, Tim Cornwell wrote:
<br>> Hi
<br>>
<br>> I am given an hour angle and wish to calculate alt/az or zenith
<br>> angle/parallactic angle for a given SkyCoord and Location. After
<br>> reading the documentation and many tries, I cannot see how to do this
<br>> with the current Astropy Time/Angle classes. It is possible?
<br>>
<br>> Thanks,
<br>> Tim
<br>>
<br>> --
<br>> Tim Cornwell
<br>> Sent with Airmail
<br>>
<br>>
<br>> ______________________________<wbr>_________________
<br>> AstroPy mailing list
<br>> <a href="mailto:AstroPy@scipy.org" target="_blank">AstroPy@scipy.org</a>
<br>> <a href="https://mail.scipy.org/mailman/listinfo/astropy" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/astropy</a>
<br>
<br>
<br>______________________________<wbr>_________________
<br>AstroPy mailing list
<br><a href="mailto:AstroPy@scipy.org" target="_blank">AstroPy@scipy.org</a>
<br><a href="https://mail.scipy.org/mailman/listinfo/astropy" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/astropy</a>
<br></div></div></span></blockquote></div></div><img src="https://appservice-dot-mystic-tempo-847.appspot.com/rr/ma2/5/AwEH2ogzdcyWjKNqWlbHtzIDSbF7TaSWjydrAXw9KVQNjths70-0AuuWatpk9naMOxFhllL6_7aMolRsbMQ0Boe_ATokGOOLV3So6aiiOPF-Qh4Kn9TLIo__BdmkTAMyW0-C4KORYim95yjBNMh3VLOeMopIrAUnoWxLI0o89Ws6a-5l-wxsl9d78yFmtgS468-zvvDKRZmgThWsR0th8hu8mubU8P0SBHRBrq67FkhAta25ouOrdOu9-Lvjihm6nu-zWjpwUskKx7_tdw0MLMvVAGKOUp1R5XVQ7p89ocR2liIBGqEpkTMFg-mN47c-nA3RlnI_II1KVHP-GgEZrobl" width="1" height="1"></div><br>______________________________<wbr>_________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/astropy</a><br>
<br></blockquote></div><br></div>