New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_moon does not support non-scalar times #5069
Comments
@bmorris3 - in the mean time, to avoid this being a blocker, maybe you could make a wrapper around astropy's |
@bmorris3 I've submitted a PR to fix this issue (#5085). You may still find that you have issues because you cannot currently use non-scalar times and a non-geocentric observer. i.e In [1]: times = Time(["2015-08-28 03:30", "2015-09-05 10:30"])
In [2]: coord.get_moon(times)
Out[2]:
<SkyCoord (GCRS: obstime=['2015-08-28 03:30:00.000' '2015-09-05 10:30:00.000'], obsgeoloc=[ 0. 0. 0.] m, obsgeovel=[ 0. 0. 0.] m / s): (ra, dec, distance) in (deg, deg, AU)
[(312.90593078, -13.48302806, 0.00243266),
(71.86378932, 17.3464189, 0.0025424)]> works fine, but In [3]: lapalma = coord.EarthLocation.of_site('lapalma')
In [4]: coord.get_moon(times, location=lapalma)
-----------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-b157ecbc7846> in <module>()
----> 1 coord.get_moon(times, location=lapalma)
/usr/local/lib/python3.5/site-packages/astropy/coordinates/solar_system.py in get_moon(time, location, ephemeris)
378 """
379
--> 380 return get_body('moon', time, location=location, ephemeris=ephemeris)
381
382 get_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]
/usr/local/lib/python3.5/site-packages/astropy/coordinates/solar_system.py in get_body(body, time, location, ephemeris)
344 gcrs = icrs.transform_to(GCRS(obstime=time,
345 obsgeoloc=obsgeoloc,
--> 346 obsgeovel=obsgeovel))
347 else:
348 gcrs = icrs.transform_to(GCRS(obstime=time))
/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in __init__(self, *args, **kwargs)
540
541 # Validate input by getting the attribute here.
--> 542 getattr(self, fnm)
543
544 args = list(args) # need to be able to pop them
/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in __get__(self, instance, frame_cls)
210 out = self.default
211
--> 212 out, converted = self.convert_input(out)
213 if instance is not None and converted:
214 setattr(instance, '_' + self.name, out)
/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in convert_input(self, value)
333 raise ValueError('The provided value has shape "{0}", but '
334 'should have shape "{1}"'.format(value.shape,
--> 335 self.shape))
336 if (oldvalue.unit == value.unit and hasattr(oldvalue, 'value') and
337 np.all(oldvalue.value == value.value)):
ValueError: The provided value has shape "(3, 2)", but should have shape "(3,)" clearly does not. A fix for #4926 is needed for the case above to work. I'll start on that next. |
get_moon
is only tested with scalar times, and fails for non-scalar times,This is a blocker on the astroplan switch from PyEphem to astropy solar system ephemerides (i.e. astropy/astroplan#35).
cc @StuartLittlefair @eteq
The text was updated successfully, but these errors were encountered: