From ac6d660cf86a838fc2eea6004f7a70df5b12b6e6 Mon Sep 17 00:00:00 2001 From: Philip Yoon Date: Tue, 10 Dec 2024 08:25:52 -0800 Subject: [PATCH] #1035: Removing the entire dict key instead of assigning value to be None --- product2dataset/product2dataset.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/product2dataset/product2dataset.py b/product2dataset/product2dataset.py index f241bc73..b5a0e6f3 100644 --- a/product2dataset/product2dataset.py +++ b/product2dataset/product2dataset.py @@ -266,11 +266,10 @@ def convert( if pge_name == "L3_DISP_S1": logger.info("Removing superfluous data from DISP-S1 metadata") logger.info("dataset_met_json.keys() = " + str(dataset_met_json.keys())) - _DELETED_TEXT = None # Get rid of bunch of data that we don't care about but takes up a lot of space - dataset_met_json["runconfig"]["localize"] = _DELETED_TEXT # This list is the same as lineage so no point in duplicatingq - dataset_met_json["runconfig"]["input_file_group"]["input_file_paths"] = _DELETED_TEXT # This list is the same as lineage so no point in duplicating + dataset_met_json["runconfig"].pop("localize")# This list is the same as lineage so no point in duplicatingq + dataset_met_json["runconfig"]["input_file_group"].pop("input_file_paths") # This list is the same as lineage so no point in duplicating # "accountability" is added elsewhere in the code so we can't delete it here # dataset_met_json["accountability"]["L3_DISP_S1"]["inputs"] = _DELETED_TEXT # We don't consume this at all @@ -278,9 +277,9 @@ def convert( for file in dataset_met_json["Files"]: logger.info("Files keys: "+ str(file.keys())) logger.info("Removing runconfig and lineage from each file") - file["lineage"] = _DELETED_TEXT # Lineage for the entire product is already at metadata level so no point in duplicating for each file - file["runconfig"]["localize"] = _DELETED_TEXT # this is superfulous - file["runconfig"]["input_file_group"]["input_file_paths"] = _DELETED_TEXT # this is superfulous + file.pop("lineage") # Lineage for the entire product is already at metadata level so no point in duplicating for each file + file["runconfig"].pop("localize") # this is superfulous + file["runconfig"]["input_file_group"].pop("input_file_paths") # this is superfulous logger.info("Reducing lineage string size by truncating basepath of lineage entries") if len(dataset_met_json["lineage"]) > 0: