Test failure with coordinates: 'NoneType' object has no attribute 'to_geodetic'
See original GitHub issue- Revert #11319
There is a test failure in coordinates
in the 32bits job:
'NoneType' object has no attribute 'to_geodetic'
https://github.com/astropy/astropy/pull/11274/checks?check_run_id=1772534200
_______________ test_skyoffset[inradec0-expectedlatlon0-tolsep0] _______________
inradec = <Quantity [45., 45.] deg>, expectedlatlon = <Quantity [0., 0.] deg>
tolsep = <Quantity 0.001 arcsec>, originradec = <Quantity [45., 45.] deg>
@pytest.mark.parametrize("inradec,expectedlatlon, tolsep", [
((45, 45)*u.deg, (0, 0)*u.deg, .001*u.arcsec),
((45, 0)*u.deg, (0, -45)*u.deg, .001*u.arcsec),
((45, 90)*u.deg, (0, 45)*u.deg, .001*u.arcsec),
((46, 45)*u.deg, (1*np.cos(45*u.deg), 0)*u.deg, 16*u.arcsec),
])
def test_skyoffset(inradec, expectedlatlon, tolsep, originradec=(45, 45)*u.deg):
origin = ICRS(*originradec)
skyoffset_frame = SkyOffsetFrame(origin=origin)
skycoord = SkyCoord(*inradec, frame=ICRS)
skycoord_inaf = skycoord.transform_to(skyoffset_frame)
assert hasattr(skycoord_inaf, 'lon')
assert hasattr(skycoord_inaf, 'lat')
expected = SkyCoord(*expectedlatlon, frame=skyoffset_frame)
assert skycoord_inaf.separation(expected) < tolsep
# Check we can also transform back (regression test for gh-11254).
> roundtrip = skycoord_inaf.transform_to(ICRS())
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/tests/test_skyoffset_transformations.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:627: in transform_to
return self.__class__(new_coord, **frame_kwargs)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:323: in __init__
setattr(self, attr, skycoord_kwargs[attr])
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:811: in __setattr__
frame_transform_graph.frame_attributes[attr].__get__(self)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/attributes.py:104: in __get__
out, converted = self.convert_input(out)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/attributes.py:451: in convert_input
transformedobj = value.transform_to(self._frame)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:619: in transform_to
new_coord = trans(self.frame, generic_frame)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/transformations.py:1422: in __call__
curr_coord = t(curr_coord, curr_toframe)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/transformations.py:1025: in __call__
return supcall(fromcoord, toframe)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/builtin_frames/icrs_observed_transforms.py:29: in icrs_to_altaz
astrom = erfa_astrom.get().apco(altaz_frame)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
frame_or_coord = <AltAz Frame (obstime=None, location=None, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron)>
@staticmethod
def apco(frame_or_coord):
'''
Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS
Arguments
---------
frame_or_coord: ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``
Frame or coordinate instance in the corresponding frame
for which to calculate the calculate the astrom values.
For this function, an AltAz or CIRS frame is expected.
'''
> lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')
E AttributeError: 'NoneType' object has no attribute 'to_geodetic'
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/erfa_astrom.py:45: AttributeError
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (22 by maintainers)
Top Results From Across the Web
AttributeError: 'NoneType' object has no attribute 'longitude'
Your error implies that geolocator.geocode(city) is returning None for one of your cities. – not_speshal. Nov 6, 2021 at 16: ...
Read more >HQ Model - Error - 'NoneType' object has no attribute 'SetGeo ...
Hello, I am receiving an error on my habitat quality model. It is giving me a error that is about 'SetGeo transform'.
Read more >MMQGIS Hub Distance Error - 'NoneType' object has no ...
I'm on Windows 7, QGIS 2.18.2 and MMQGIS 2017.2.28. Any ideas? An error has occurred while executing Python code: AttributeError: 'NoneType' ...
Read more >AttributeError: 'NoneType' object has no attribute 'split'
Hello, i'm trying to make a pcb, i have gerber created eith autodesk eagle, when i try to generate a cncjob object i...
Read more >Why this 'NoneType' object has no attribute 'append' occur?
This is my code but I stuck in finishing this mission. the error occurs "'NoneType' object has no attribute 'append' " lloyd =...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is that the error is actually wrong: it is using the
origin
instance for a different OffsetFrame than the one that is passed in. It could happen in user code too (if they have offset frames in different coordinate systems).p.s. I do think we could have a relatively hacky work-around, but need to have some time to think it through.
Yikes, this is tricky: I cannot consistently reproduce getting the error on the 2nd run with your one-liner calling
astropy.test
twice. The first time I tried, it worked, but now tried a few times again and both calls just pass. Well, at least perhaps that is what happened to your cache clearing too?!