Skip to content

Commit

Permalink
deprecate second way to get RR, add (commented) suggested method usin…
Browse files Browse the repository at this point in the history
…g latest mt_metadata
  • Loading branch information
kkappler committed Sep 7, 2023
1 parent 7f88940 commit b0c270b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions aurora/test_utils/earthscope/01_test_load_spud_tfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

# Config Params
XML_SOURCES = ["emtf", "data"]
USE_SECOND_WAY_OF_PARSING_REMOTES = False # Deprecated
N_PARTITIONS = 1

def prepare_dataframe_for_scraping(restrict_to_first_n_rows=False,):
Expand All @@ -73,8 +72,7 @@ def prepare_dataframe_for_scraping(restrict_to_first_n_rows=False,):
spud_df[f"{xml_source}_error_message"] = ""
spud_df[f"{xml_source}_remote_ref_type"] = ""
spud_df[f"{xml_source}_remotes"] = ""
if USE_SECOND_WAY_OF_PARSING_REMOTES:
spud_df[f"{xml_source}_remotes_2"] = ""


return spud_df

Expand All @@ -88,14 +86,20 @@ def enrich_row(row):
for xml_source in XML_SOURCES:
xml_path = SPUD_XML_PATHS[xml_source].joinpath(row[f"{xml_source}_xml_filebase"])
try:
spud_tf = load_xml_tf(xml_path)
rr_type = get_rr_type(spud_tf)
tf = load_xml_tf(xml_path)
# OLD
rr_type = get_rr_type(tf)
row[f"{xml_source}_remote_ref_type"] = rr_type
remotes = get_remotes_from_tf(spud_tf)
remotes = get_remotes_from_tf(tf)
row[f"{xml_source}_remotes"] = ",".join(remotes)
if USE_SECOND_WAY_OF_PARSING_REMOTES:
remotes2 = get_remotes_from_tf_2(spud_tf)
row[f"{xml_source}_remotes_2"] = ",".join(remotes)

# NEW
# remotes = tf.station_metadata.transfer_function.remote_references
# remotes = [x for x in remotes if x != tf.station]
# Do we want the "self" station being returned in remotes
# rr_type = tf.station_metadata.transfer_function.processing_type
# row[f"{xml_source}_remote_ref_type"] = rr_type
# row[f"{xml_source}_remotes"] = ",".join(remotes)

except Exception as e:
row[f"{xml_source}_error"] = True
Expand Down Expand Up @@ -137,7 +141,7 @@ def summarize_errors():
def main():
# normal
# results_df = batch_process(row_end=1)
results_df = batch_process()
results_df = batch_process()#row_end=100)

# run only data
#results_df = review_spud_tfs(xml_sources = ["data_xml_path", ])
Expand Down

0 comments on commit b0c270b

Please sign in to comment.