From 055feb347c818c9a3f892fb38bd14f64e905b1af Mon Sep 17 00:00:00 2001 From: Lisha Ramon Date: Mon, 18 Dec 2023 14:21:35 -0500 Subject: [PATCH] update google sheet table prints. Accidental json file changes --- data/2mass_j12560183-1257276.json | 8 ++++---- data/Versions.json | 2 +- scripts/ingests/ingest_BYW_2024.py | 20 +++++++++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/data/2mass_j12560183-1257276.json b/data/2mass_j12560183-1257276.json index eed3a0b12..6f15633b6 100644 --- a/data/2mass_j12560183-1257276.json +++ b/data/2mass_j12560183-1257276.json @@ -30,6 +30,9 @@ { "other_name": "VHS 1256-1257b" }, + { + "other_name": "VHS 1256b" + }, { "other_name": "VHS J125601.92-125723.9 b" }, @@ -38,9 +41,6 @@ }, { "other_name": "WISEA J125601.66-125728.7" - }, - { - "other_name": "VHS 1256b" } ], "Parallaxes": [ @@ -267,4 +267,4 @@ "reference": "Gauz15" } ] -} +} \ No newline at end of file diff --git a/data/Versions.json b/data/Versions.json index 9ad0796a2..9df07db7e 100644 --- a/data/Versions.json +++ b/data/Versions.json @@ -57,6 +57,6 @@ "version": "latest", "start_date": "2023-12-12", "end_date": null, - "description": "Version in development" + "description": "Version in development" } ] \ No newline at end of file diff --git a/scripts/ingests/ingest_BYW_2024.py b/scripts/ingests/ingest_BYW_2024.py index 84e764305..28560368d 100644 --- a/scripts/ingests/ingest_BYW_2024.py +++ b/scripts/ingests/ingest_BYW_2024.py @@ -4,6 +4,8 @@ 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 @@ -11,7 +13,7 @@ # 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: @@ -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)