Skip to content

Commit

Permalink
planetarynames website updated design and naming to different english…
Browse files Browse the repository at this point in the history
… spelling
  • Loading branch information
cyschneck committed Mar 1, 2024
1 parent 8c5193c commit 9ce164d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion pydar/data/feature_name_details.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature Name,Northernmost Latitude,Southernmost Latitude,Easternmost Longitude,Westernmost Longitude,Center Latitude,Center Longitude,Origin of Name
Feature Name,Northmost Latitude,Southmost Latitude,Eastmost Longitude,Westmost Longitude,Center Latitude,Center Longitude,Origin of Name
Aaru,10.00,10.00,340.00,340.00,10.00,340.00,Egyptian abode of the blessed dead.
Abaya Lacus,73.70,72.75,43.39,48.00,73.17,45.55,Lake in Ethiopia.
Adiri,-10.00,-10.00,210.00,210.00,-10.00,210.00,Melanesian afterworld where life is easier than on Earth.
Expand Down
24 changes: 12 additions & 12 deletions pydar/retrieve_ids_by_time_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def latitudeLongitudeWithFeatureNameFromCSV():
flyby_dataframe = pd.read_csv(flyby_csv_file)

for index, row in flyby_dataframe.iterrows():
feature_name_dict[row["Feature Name"]] = {"Southernmost Latitude": row["Southernmost Latitude"],
"Northernmost Latitude": row["Northernmost Latitude"],
"Easternmost Longitude": row["Easternmost Longitude"],
"Westernmost Longitude": row["Westernmost Longitude"],
feature_name_dict[row["Feature Name"]] = {"Southmost Latitude": row["Southmost Latitude"],
"Northmost Latitude": row["Northmost Latitude"],
"Eastmost Longitude": row["Eastmost Longitude"],
"Westmost Longitude": row["Westmost Longitude"],
"Center Latitude": row["Center Latitude"],
"Center Longitude": row["Center Longitude"]}

Expand All @@ -50,10 +50,10 @@ def retrieveIDSByFeatureName(feature_name=None):
raise ValueError(f"Feature Name '{feature_name}' not in available in features list = {list(feature_name_csv_dict.keys())}")

feature_dict = feature_name_csv_dict[feature_name]
min_feature_latitude = min([feature_dict["Northernmost Latitude"], feature_dict["Southernmost Latitude"]])
max_feature_latitude = max([feature_dict["Northernmost Latitude"], feature_dict["Southernmost Latitude"]])
min_feature_longtidue = min([feature_dict["Easternmost Longitude"], feature_dict["Westernmost Longitude"]])
max_feature_longtidue = max([feature_dict["Easternmost Longitude"], feature_dict["Westernmost Longitude"]])
min_feature_latitude = min([feature_dict["Northmost Latitude"], feature_dict["Southmost Latitude"]])
max_feature_latitude = max([feature_dict["Northmost Latitude"], feature_dict["Southmost Latitude"]])
min_feature_longtidue = min([feature_dict["Eastmost Longitude"], feature_dict["Westmost Longitude"]])
max_feature_longtidue = max([feature_dict["Eastmost Longitude"], feature_dict["Westmost Longitude"]])
flyby_ids = retrieveIDSByLatitudeLongitudeRange(min_latitude=min_feature_latitude,
max_latitude=max_feature_latitude,
min_longitude=min_feature_longtidue,
Expand Down Expand Up @@ -271,11 +271,11 @@ def twoRangesIntersect(min_feature, max_feature, min_user, max_user):
return intersectionFound

for feature_name, position_dict in feature_name_csv_dict.items():
min_feature_latitude = min([float(position_dict["Northernmost Latitude"]), float(position_dict["Southernmost Latitude"])])
max_feature_latitude = max([float(position_dict["Northernmost Latitude"]), float(position_dict["Southernmost Latitude"])])
min_feature_latitude = min([float(position_dict["Northmost Latitude"]), float(position_dict["Southmost Latitude"])])
max_feature_latitude = max([float(position_dict["Northmost Latitude"]), float(position_dict["Southmost Latitude"])])
if twoRangesIntersect(min_feature_latitude, max_feature_latitude, min_latitude, max_latitude):
min_feature_longitude = min([float(position_dict["Westernmost Longitude"]), float(position_dict["Easternmost Longitude"])])
max_feature_longitude = max([float(position_dict["Westernmost Longitude"]), float(position_dict["Easternmost Longitude"])])
min_feature_longitude = min([float(position_dict["Westmost Longitude"]), float(position_dict["Eastmost Longitude"])])
max_feature_longitude = max([float(position_dict["Westmost Longitude"]), float(position_dict["Eastmost Longitude"])])
if twoRangesIntersect(min_feature_longitude, max_feature_longitude, min_longitude, max_longitude):
feature_names_list.append(feature_name)

Expand Down
52 changes: 26 additions & 26 deletions pydar/updateCsvFeatureNameDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,29 @@ def updateCsvFeatureNameDetails():
feature_html = request.urlopen(base_url + feature_ahref)
logger.info(f"[{i+1}/{len(ahref_lst)}] Retrieving: {base_url + feature_ahref}")
soup = BeautifulSoup(feature_html, 'html.parser')
table = soup.find("div", {"id":"layout_content_wrapper"})
tr = table.find_all("tr")
tables = soup.find_all('table', class_='usa-table')
feature_object = [None, None, None, None, None, None, None, None]
for i in tr:
feature_row = ((i.text).lstrip()).split("\n")
feature_row = [f.strip() for f in feature_row if f != '' and re.search('[a-zA-Z-?\d+]', f)]
if len(feature_row) == 2:
if feature_row[0] == "Feature Name":
feature_object[0] = feature_row[1]
if feature_row[0] == "Northernmost Latitude":
feature_object[1] = feature_row[1].split(" ")[0]
if feature_row[0] == "Southernmost Latitude":
feature_object[2] = feature_row[1].split(" ")[0]
if feature_row[0] == "Easternmost Longitude":
feature_object[3] = feature_row[1].split(" ")[0]
if feature_row[0] == "Westernmost Longitude":
feature_object[4] = feature_row[1].split(" ")[0]
if feature_row[0] == "Center Latitude":
feature_object[5] = feature_row[1].split(" ")[0]
if feature_row[0] == "Center Longitude":
feature_object[6] = feature_row[1].split(" ")[0]
if feature_row[0] == "Origin":
feature_object[7] = feature_row[1]
for table in tables:
for row in table.tbody.find_all("tr"):
feature_row = ((row.text).lstrip()).split("\n")
feature_row = [f.strip() for f in feature_row if f != '' and re.search(r'[a-zA-Z-?\d+]', f)]
if len(feature_row) == 2:
if feature_row[0] == "Feature Name":
feature_object[0] = feature_row[1]
if feature_row[0] == "Northmost Latitude":
feature_object[1] = feature_row[1].split(" ")[0]
if feature_row[0] == "Southmost Latitude":
feature_object[2] = feature_row[1].split(" ")[0]
if feature_row[0] == "Eastmost Longitude":
feature_object[3] = feature_row[1].split(" ")[0]
if feature_row[0] == "Westmost Longitude":
feature_object[4] = feature_row[1].split(" ")[0]
if feature_row[0] == "Center Latitude":
feature_object[5] = feature_row[1].split(" ")[0]
if feature_row[0] == "Center Longitude":
feature_object[6] = feature_row[1].split(" ")[0]
if feature_row[0] == "Origin":
feature_object[7] = feature_row[1]
feature_options.append(feature_object)

# Add Huygens landing site manually
Expand All @@ -99,10 +99,10 @@ def updateCsvFeatureNameDetails():

# Wrte to CSV
header_options = ["Feature Name",
"Northernmost Latitude",
"Southernmost Latitude",
"Easternmost Longitude",
"Westernmost Longitude",
"Northmost Latitude",
"Southmost Latitude",
"Eastmost Longitude",
"Westmost Longitude",
"Center Latitude",
"Center Longitude",
"Origin of Name"]
Expand Down

0 comments on commit 9ce164d

Please sign in to comment.