Advertisement
ziriuz84

RecursionError code

May 23rd, 2023 (edited)
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. def neocp_confirmation(payload):
  2.     r=requests.get('https://www.minorplanetcenter.net/Extended_Files/neocp.json')
  3.     data=r.json()
  4.     lat = payload.latitude
  5.     long = payload.longitude
  6.     location = EarthLocation.from_geodetic(lon=float(long), lat=float(lat))
  7.     observing_date = Time(datetime.datetime.utcnow())
  8.     altaz = AltAz(location=location, obstime=observing_date)
  9.     result = []
  10.     for item in data:
  11.         coord = SkyCoord(float(item["R.A."]) * u.deg, float(item["Decl."]) * u.deg)
  12.         coord_altaz = coord.transform_to(altaz)
  13.         print(item)
  14.         # if int(
  15.         #     item["Score"] > payload.min_score
  16.         #     and is_visible(payload, coord, observing_date)
  17.         #     and float(item["V"] < payload.max_magnitude)
  18.         # ):
  19.         asteroid = {
  20.             "Temp_Desig": item["Temp_Desig"],
  21.             "Score": int(item["Score"]),
  22.             "R.A.": coord.ra.to_string(u.hour),
  23.             "Dec.": coord.dec.to_string(u.degree, alwayssign=True),
  24.             "Alt.": coord_altaz.alt, # this makes RecursionError
  25.             "V": float(item["V"]),
  26.             "N.Obs": int(item["NObs"]),
  27.             "Arc": float(item["Arc"]),
  28.             "Not_Seen_days": float(item["Not_Seen_dys"]),
  29.         }
  30.         # print(asteroid)
  31.         result.append(asteroid)
  32.     return result
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement