Skip to content

Commit

Permalink
update google sheet table prints. Accidental json file changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LishaRamon committed Dec 18, 2023
1 parent 7ded761 commit 055feb3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
8 changes: 4 additions & 4 deletions data/2mass_j12560183-1257276.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
{
"other_name": "VHS 1256-1257b"
},
{
"other_name": "VHS 1256b"
},
{
"other_name": "VHS J125601.92-125723.9 b"
},
Expand All @@ -38,9 +41,6 @@
},
{
"other_name": "WISEA J125601.66-125728.7"
},
{
"other_name": "VHS 1256b"
}
],
"Parallaxes": [
Expand Down Expand Up @@ -267,4 +267,4 @@
"reference": "Gauz15"
}
]
}
}
2 changes: 1 addition & 1 deletion data/Versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
"version": "latest",
"start_date": "2023-12-12",
"end_date": null,
"description": "Version in development"
"description": "Version in development"
}
]
20 changes: 15 additions & 5 deletions scripts/ingests/ingest_BYW_2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
import astropy.units as u
import pandas as pd
import csv
import requests
from io import StringIO
from astropy.coordinates import Angle

SAVE_DB = True # save the data files in addition to modifying the .db file
RECREATE_DB = True # recreates the .db file from the data files
# LOAD THE DATABASE
db = load_simpledb('SIMPLE.db', recreatedb=RECREATE_DB)


#Attempt 1
#csv_file_path = "C:\Users\LRamon\Documents\Austin-BYW-Benchmark-Sources.-.Sheet1.csv"

#with open(csv_file_path, 'r') as file:
Expand All @@ -25,23 +27,31 @@



# live google sheet
# live google sheet (Attempt 2)
#sheet_id = '1JFa8F4Ngzp3qAW8NOBurkz4bMKo9zXYeF6N1vMtqDZs'
#df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{sheet_id}/export?format=csv")
#print(df)


#(Attempt 3)
sheet_id = '1JFa8F4Ngzp3qAW8NOBurkz4bMKo9zXYeF6N1vMtqDZs'
link = f"https://docs.google.com/spreadsheets/d/{sheet_id}/export?format=csv"

# Fetch the content from the URL
response = requests.get(link)
data = response.text

# Use io.StringIO to create a file-like object
data_file = StringIO(data)

#define the column names
columns = ['source', 'ra', 'dec', 'epoch', 'equinox', 'shortname', 'reference', 'other_ref', 'comments']
#read the csv data into an astropy table
byw_table = ascii.read(link, format='csv', data_start=2, data_end=90, header_start=1, names=columns, guess=False, delimiter=',')
byw_table = ascii.read(link, format='csv', data_start=1, data_end=90, header_start=1, names=columns, guess=False, fast_reader=False, delimiter=',')

data_columns = ['Source', 'RA', 'Dec', 'Epoch', 'Equinox', 'Shortname', 'Reference', 'Other_ref', 'Comments'] # columns with wanted data values
#data_columns = ['Source', 'RA', 'Dec', 'Epoch', 'Equinox', 'Shortname', 'Reference', 'Other_ref', 'Comments'] # columns with wanted data values
#byw_table.rename_columns(data_columns)

byw_table.rename_columns(data_columns)
#print result astropy table
print(byw_table)

Expand Down

0 comments on commit 055feb3

Please sign in to comment.