Open rhaas80 opened 4 years ago
Please see #8 . We still need to update this repo to reflect that the download mechanisms have been superseded with a new sxs
package API. The new API is demonstrated in the repo https://github.com/moble/sxs_notebooks
@rhaas80 that's valid, probably it shouldn't have been closed. Or, we should have opened a separate issue like 'Deprecate this repo' instead. @geoffrey4444 thoughts?
If deprecating the whole repo (which would be a shame as having a programmatic interface is quite useful) then care must be taken to remove all references to it on the website. Eg https://data.black-holes.org/waveforms/index.html
Is this issue has been resolved? I am facing the same problem with
Name: sxs
Version: 2021.0.5
Many thanks for considering my request.
Is this issue has been resolved? I am facing the same problem with
Name: sxs Version: 2021.0.5
Many thanks for considering my request.
You may try the following code
from sxs import utilities as utils
def download_file(common_meta, meta, com_file, horizon, sxs_ids=None, dry_run=True, highest_lev_only=False):
# read all catalog list
catalog_list_file="sxs_catalog_zen.json"
json1_file = open(catalog_list_file)
json1_str = json1_file.read()
catalog_json = json.loads(json1_str)
catalog_levels_file="sxs_catalog_zen_resolutions_available.json"
json2_file = open(catalog_levels_file)
json2_str = json2_file.read()
catalog_levels_json = json.loads(json2_str)
file_list = [common_meta, meta, com_file, horizon]
if sxs_ids is None:
sxs_ids=['SXS:BBH:0444']
for sxs_id in sxs_ids:
levels_json = catalog_levels_json[sxs_id]
max_level = len(levels_json)
max_level_label = 'Lev'+str(max_level)
dir_name = sxs_id.replace(":", "_", 2)
for file in np.array(catalog_json[sxs_id]['files']):
file_name = file['filename']
if highest_lev_only==False:
if any(name in file_name for name in file_list):
download = file['links']['download']
file_path = dir_name + '/' + file_name
print("Downloading {0} and writing to file {1}...".format(file_name, file_path))
utils.download_file(download, file_path)
else:
if any(name in file_name for name in file_list) and max_level_label in file_name:
download = file['links']['download']
file_path = dir_name + '/' + file_name
print("Downloading {0} and writing to file {1}...".format(file_name, file_path))
utils.download_file(download, file_path)
and call as
download_file("common-metadata.txt", "metadata.txt", \
"rhOverM_Asymptotic_GeometricUnits_CoM.h5", \
"Horizons.h5", \
sxs_ids = ['SXS:BBH:0444'], \
dry_run = True, \
highest_lev_only = False)
Before you try the above code, you need to create two files, sxs_catalog_zen.json and sxs_catalog_zen_resolutions_available.json. These files can be generated by executing code Examples/sxs_zenodo_metadata_example.ipynb
Good luck!
Hello all,
I just wanted to try out
sxs_catalog_download_example.ipynb
(git hash dac7198) using:but get in the second cell:
when using
pip install sxs
. I ended up withsxs
2020.9.19 (so fairly new).