From 4bb6593258bb8de7cfd9c539bae72dda52bb86a4 Mon Sep 17 00:00:00 2001 From: jokerxin Date: Fri, 15 Mar 2024 19:19:36 +0800 Subject: [PATCH 1/2] Ensure the parent directory exists to avoid error --- .../by_XML/constellation_configuration.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/constellation_generation/by_XML/constellation_configuration.py b/src/constellation_generation/by_XML/constellation_configuration.py index f5d67966..3c7cf08b 100644 --- a/src/constellation_generation/by_XML/constellation_configuration.py +++ b/src/constellation_generation/by_XML/constellation_configuration.py @@ -51,6 +51,10 @@ def constellation_configuration(dT , constellation_name): # convert string to int type number_of_shells = int(constellation_configuration_information['constellation']['number_of_shells']) shells = [] + # ensure the data/XML_constellation/ directory exists + data_directory = "data/XML_constellation/" + # This will create the directory if it does not exist + os.makedirs(data_directory, exist_ok=True) # determine whether the .h5 file of the delay and satellite position data of the current constellation exists. If # it exists, delete the file and create an empty .h5 file. If it does not exist, directly create an empty .h5 file. file_path = "data/XML_constellation/" + constellation_name + ".h5" From 70405b02bee5a40b093858b6f398e2559f3f85b7 Mon Sep 17 00:00:00 2001 From: jokerxin Date: Fri, 15 Mar 2024 20:53:38 +0800 Subject: [PATCH 2/2] Supplement the directory that need to be ensured --- .../by_TLE/constellation_configuration.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/constellation_generation/by_TLE/constellation_configuration.py b/src/constellation_generation/by_TLE/constellation_configuration.py index cea91e65..4bc94790 100644 --- a/src/constellation_generation/by_TLE/constellation_configuration.py +++ b/src/constellation_generation/by_TLE/constellation_configuration.py @@ -34,6 +34,10 @@ def constellation_configuration(dT , constellation_name): # calculate and save the longitude, latitude and altitude information of different satellites according to shell # and timeslot + # ensure the data/TLE_constellation/ directory exists + data_directory = "data/TLE_constellation/" + # This will create the directory if it does not exist + os.makedirs(data_directory, exist_ok=True) # determine whether the .h5 file of the delay and satellite position data of the current constellation exists. If # it exists, delete the file and create an empty .h5 file. If it does not exist, directly create an empty .h5 file. file_path = "data/TLE_constellation/" + constellation_name + ".h5"