@@ -454,6 +454,10 @@ def run(
454454 )
455455 match_row_target = catalog_match_target ['match_row' ]
456456 cat_left = cat_target [~ (match_row_target >= 0 ) & select_target ]
457+ cat_left .rename_columns (
458+ cat_left .colnames ,
459+ [f"{ config .column_matched_prefix_target } { col } " for col in cat_left .colnames ],
460+ )
457461 # This may be slower than pandas but will, for example, create
458462 # masked columns for booleans, which pandas does not support.
459463 # See https://github.com/pandas-dev/pandas/issues/46662
@@ -488,22 +492,23 @@ def run(
488492 )
489493 )
490494 for column_coord_best , column_coord_ref , column_coord_target in zip (
491- columns_coord_best ,
492- (config .coord_format .column_ref_coord1 , config .coord_format .column_ref_coord2 ),
493- (config .coord_format .column_target_coord1 , config .coord_format .column_target_coord2 ),
495+ columns_coord_best ,
496+ (config .coord_format .column_ref_coord1 , config .coord_format .column_ref_coord2 ),
497+ (config .coord_format .column_target_coord1 , config .coord_format .column_target_coord2 ),
494498 ):
495499 column_full_ref = f'{ config .column_matched_prefix_ref } { column_coord_ref } '
500+ column_full_target = f'{ config .column_matched_prefix_target } { column_coord_target } '
496501 values = cat_matched [column_full_ref ]
497502 unit = values .unit
498503 values_bad = np .ma .masked_invalid (values ).mask
499504 # Cast to an unmasked array - there will be no bad values
500505 values = np .array (values )
501- values [values_bad ] = cat_matched [column_coord_target ][values_bad ]
506+ values [values_bad ] = cat_matched [column_full_target ][values_bad ]
502507 cat_matched [column_coord_best ] = values
503508 cat_matched [column_coord_best ].unit = unit
504509 cat_matched [column_coord_best ].description = (
505510 f"Best { columns_coord_best } value from { column_full_ref } if available"
506- f" else { column_coord_target } "
511+ f" else { column_full_target } "
507512 )
508513
509514 retStruct = pipeBase .Struct (cat_matched = cat_matched )
0 commit comments