-
-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
I was trying to download the constellations file to draw constellations on a star chart. But when I tried the code from the documentation here:
from skyfield.api import load
from skyfield.data import stellarium
url = ('https://raw.githubusercontent.com/Stellarium/stellarium/master'
'/skycultures/modern_st/constellationship.fab')
with load.open(url) as f:
constellations = stellarium.parse_constellations(f)
I got the error:
OSError: cannot download https://raw.githubusercontent.com/Stellarium/stellarium/master/skycultures/modern_st/constellationship.fab because HTTP Error 404: Not Found
This is my current "brute force" workaround which uses the index.json from the stellarium repository instead:
import pandas as pd
import json
from skyfield.api import Loader
load = Loader(<my path to data folder>)
url = 'https://raw.githubusercontent.com/Stellarium/stellarium/refs/heads/master/skycultures/modern_st/index.json'
with load.open(url, filename='constellations.json') as f:
data = json.load(f)
const_data = data['constellations']
names = []
lines = []
for const in const_data:
names.append(const['common_name']['native'])
lines.append(const['lines'])
const_df = pd.DataFrame({
'name': names,
'lines': lines
})
the changes to the graphing code:
lines_xy = [
[stars.loc[star, ['x', 'y']].values for star in line]
for const in const_df['stars'].values for line in const
]
Metadata
Metadata
Assignees
Labels
No labels