Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sxs.zenodo.download not found in sxs_catalog_download_example.ipynb #9

Open
rhaas80 opened this issue Oct 19, 2020 · 6 comments
Open
Labels
wontfix This will not be worked on

Comments

@rhaas80
Copy link

rhaas80 commented Oct 19, 2020

Hello all,

I just wanted to try out sxs_catalog_download_example.ipynb (git hash dac7198) using:

git clone https://github.com/sxs-collaboration/catalog_tools.git
cd catalog_tools/
cd Examples/
jupyter-notebook --browser=no --port 12345 --ip 127.0.0.1 sxs_catalog_download_example.ipynb

but get in the second cell:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-083f8445225d> in <module>
----> 1 zen.download.matching("common-metadata.txt", "metadata.txt", \
      2                       "rhOverM_Asymptotic_GeometricUnits_CoM.h5", \
      3                       "Horizons.h5", \
      4                       sxs_ids = ['SXS:BBH:0444'], \
      5                       dry_run = True, \

AttributeError: module 'sxs.zenodo' has no attribute 'download'

when using pip install sxs. I ended up with sxs 2020.9.19 (so fairly new).

@duetosymmetry
Copy link
Member

duetosymmetry commented Oct 19, 2020

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

@duetosymmetry duetosymmetry added the wontfix This will not be worked on label Oct 19, 2020
@rhaas80
Copy link
Author

rhaas80 commented Oct 19, 2020

#8 is marked as closed. Shouldn't it be only closed once the issue no longer exists?

@duetosymmetry
Copy link
Member

@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?

@rhaas80
Copy link
Author

rhaas80 commented Oct 19, 2020

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

@KrishnenduGit
Copy link

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.

@ijhwlee
Copy link

ijhwlee commented Mar 3, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants