Skip to content

Commit

Permalink
Fix os.sep issue with url
Browse files Browse the repository at this point in the history
  • Loading branch information
odstrcilt authored Nov 29, 2023
1 parent a493f68 commit 7420d65
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions aurora/adas_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)


def get_adas_file_loc(filename, filetype="adf11"):
def get_adas_file_loc(filename, filetype="adf11", tmp_folder=None):
"""Find location of requested atomic data file for the indicated ion.
Accepts all ADAS "derived" data file types
(adf11, adf12, adf13, adf15, adf21, adf22).
Expand Down Expand Up @@ -75,12 +75,12 @@ def fetch_file(filename, filetype, loc):

url = "https://open.adas.ac.uk/download/" + filetype + '/'
if filetype == "adf11":
filename_mod = filename.split("_")[0] + os.sep + filename
filename_mod = filename.split("_")[0] + '/' + filename

elif filetype in ["adf12", "adf13", "adf21", "adf22"]:
filename_mod = (
filename.replace("#", "][").split("_")[0]
+ os.sep
+ '/'
+ filename.replace("#", "][")
)

Expand All @@ -99,15 +99,15 @@ def fetch_file(filename, filetype, loc):
else:
# patterns may be different, attempt simple guess:
filename_mod = (
filename.split("_")[0] + os.sep + filename.replace("#", "][")
filename.split("_")[0] + '/' + filename.replace("#", "][")
)
else:
raise ValueError(
"ADAS file type/format not recognized.\n"
+ "Could not find it or download it automatically!"
)

r = requests.get(url + os.sep + filename_mod)
r = requests.get(url + '/' + filename_mod)


if len(r.text) < 1000:
Expand Down Expand Up @@ -180,6 +180,7 @@ def adas_files_dict():
files["H"]["brs"] = "brs05360.dat"
files["H"]["pbs"] = "pbsx7_h.dat"
files["H"]["prc"] = "prc89_h.dat"
files["D"] = files["H"]
files["He"] = {} # 2
files["He"]["acd"] = "acd96_he.dat"
files["He"]["scd"] = "scd96_he.dat"
Expand Down

0 comments on commit 7420d65

Please sign in to comment.