cloudcatalog


Namecloudcatalog JSON
Version 0.6.1 PyPI version JSON
download
home_pageNone
SummaryAPI for accessing the generalized Cloud Catalog (cloudcatalog) specification for sharing data in and across clouds
upload_time2024-08-21 20:37:45
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License
keywords cloud index catalog aws
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cloud Catalog (cloudcatalog) Tool
This tool is designed for retrieving file catalog (index) files from a specific ID entry in a catalog within a bucket. It also includes search functionality for searching through all data index catalogs found in the bucket list.

## Use Case
Suppose there is a mission on S3 that follows the HelioCloud 'Cloud Catalog' specification, and you want to obtain specific files from this mission.

### Initial Setup and Global Catalog
First, install the tool if it has not been already installed. Then, import the tool into a script or shell. You will likely want to search the global catalog to find the specific bucket/catalog containing the data catalog files.

```python
import cloudcatalog

# Create CatalogRegistry object which will by default pull from the Heliocloud global catalog
# or if an environment variable has been set for another global catalog, it will pull from there
cr = cloudcatalog.CatalogRegistry()

# Print out the entire global catalog
print(cr.get_catalog())

# Print out name + region of all global catalog entries
# If we know roughly what the name of the overarching bucket would be,
# this will help us find the exact name we need for the mission we want.
# Otherwise, other methods must be used to search for the bucket of interests.
print(cr.get_entries())
```

### Finding and Requesting the File Catalog
At this point, you should have found the bucket containing the data of interest. Next, you will want to search the bucket-specific catalog (data catalog) for the ID representing the mission you want to obtain data for.

```python
# With the bucket name we have obtained (possibly by using cr.get_endpoint(name, region_prefix=''))
bucket_name = 'a-bucket-name'
# If this is not a public bucket, you may need to pass access_key or other boto S3 client specific params to get the data
# cache_folder is only used if cache is True and defaults to `bucket_name + '_cache'`
fr = cloudcatalog.CloudCatalog(bucket_name, cache_folder=None, cache=True)  

# Print out the entire local catalog (datasets)
print(fr.get_catalog())

# To find the specific ID we can also get the ID + Title by
print(fr.get_entries())

# Now with the ID we can request the catalog index files
# This if successful, will get us a Pandas dataframe of the file index
# and if we previously had set cache to True in initialization, it will
# also save the downloaded file index
fr_id = 'a_dataset_id_from_the_catalog'
start_date = '2007-02-01T00:00:00Z'  # A ISO 8601 standard time and a valid time witin the mission/file-index
stop_date = None  # A ISO 8601 standard time or None if want all the file indices after start_date
myfiles = fr.request_cloud_catalog(fr_id, start_date=start_date, end_date=end_date, overwrite=False)
```

### Streaming Data from the File Catalog
You now have a pandas DataFrame with startdate, stopdate, key, and filesize for all the files of the mission within your specified start and end dates. From here, you can use the key to stream some of the data through EC2, a Lambda, or other processing methods.

This tool also offers a simple function for streaming the data once the file catalog is obtained:

```python
cloudcatalog.CloudCatalog.stream(cloud_catalog, lambda bfile, startdate, stopdate, filesize: print(len(bo.read()), filesize))
```

### Searching the Entire Catalog
As an alternative to manually searching, you can use the EntireCatalogSearch class to find a catalog entry:

```python
search = cloudcatalog.EntireCatalogSearch()
top_search_result = search.search_by_keywords(['vector', 'mission', 'useful'])[0]
# Prints out the top result with all the catalog info, including id, loc, startdate, etc.
print(top_search_result)
```

### Terse example for an SDO fetch of the filelist for all the 94A EUV images (1,624,900 files)
```
import cloudcatalog
dataid = "aia_0094"
s3bucket="s3://gov-nasa-hdrl-data1/"
fr = cloudcatalog.CloudCatalog(s3bucket)
mySDOlist = fr.request_cloud_catalog(dataid,
	    start_date=fr.get_entry(dataid)['start'],
	    stop_date=fr.get_entry(dataid)['stop'])
```

### Terse example for an MMS fetch of the filelist for all of a specific MMS item (64,383 files)
```
import cloudcatalog
dataid = "mms1_feeps_brst_electron"
s3bucket="s3://helio-public/"
fr = cloudcatalog.CloudCatalog(s3bucket)
myMMSlist = fr.request_cloud_catalog(dataid,
	    start_date=fr.get_entry(dataid)['start'],
	    stop_date=fr.get_entry(dataid)['stop'])
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cloudcatalog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "cloud, index, catalog, AWS",
    "author": null,
    "author_email": "Johns Hopkins University Applied Physics Laboratory LLC <sandy.antunes@jhuapl.edu>",
    "download_url": "https://files.pythonhosted.org/packages/5c/c2/785bda332e29dc552ff5dc5e90650eb171d5ce4ef7fb658a7a7c66401c3f/cloudcatalog-0.6.1.tar.gz",
    "platform": null,
    "description": "# Cloud Catalog (cloudcatalog) Tool\nThis tool is designed for retrieving file catalog (index) files from a specific ID entry in a catalog within a bucket. It also includes search functionality for searching through all data index catalogs found in the bucket list.\n\n## Use Case\nSuppose there is a mission on S3 that follows the HelioCloud 'Cloud Catalog' specification, and you want to obtain specific files from this mission.\n\n### Initial Setup and Global Catalog\nFirst, install the tool if it has not been already installed. Then, import the tool into a script or shell. You will likely want to search the global catalog to find the specific bucket/catalog containing the data catalog files.\n\n```python\nimport cloudcatalog\n\n# Create CatalogRegistry object which will by default pull from the Heliocloud global catalog\n# or if an environment variable has been set for another global catalog, it will pull from there\ncr = cloudcatalog.CatalogRegistry()\n\n# Print out the entire global catalog\nprint(cr.get_catalog())\n\n# Print out name + region of all global catalog entries\n# If we know roughly what the name of the overarching bucket would be,\n# this will help us find the exact name we need for the mission we want.\n# Otherwise, other methods must be used to search for the bucket of interests.\nprint(cr.get_entries())\n```\n\n### Finding and Requesting the File Catalog\nAt this point, you should have found the bucket containing the data of interest. Next, you will want to search the bucket-specific catalog (data catalog) for the ID representing the mission you want to obtain data for.\n\n```python\n# With the bucket name we have obtained (possibly by using cr.get_endpoint(name, region_prefix=''))\nbucket_name = 'a-bucket-name'\n# If this is not a public bucket, you may need to pass access_key or other boto S3 client specific params to get the data\n# cache_folder is only used if cache is True and defaults to `bucket_name + '_cache'`\nfr = cloudcatalog.CloudCatalog(bucket_name, cache_folder=None, cache=True)  \n\n# Print out the entire local catalog (datasets)\nprint(fr.get_catalog())\n\n# To find the specific ID we can also get the ID + Title by\nprint(fr.get_entries())\n\n# Now with the ID we can request the catalog index files\n# This if successful, will get us a Pandas dataframe of the file index\n# and if we previously had set cache to True in initialization, it will\n# also save the downloaded file index\nfr_id = 'a_dataset_id_from_the_catalog'\nstart_date = '2007-02-01T00:00:00Z'  # A ISO 8601 standard time and a valid time witin the mission/file-index\nstop_date = None  # A ISO 8601 standard time or None if want all the file indices after start_date\nmyfiles = fr.request_cloud_catalog(fr_id, start_date=start_date, end_date=end_date, overwrite=False)\n```\n\n### Streaming Data from the File Catalog\nYou now have a pandas DataFrame with startdate, stopdate, key, and filesize for all the files of the mission within your specified start and end dates. From here, you can use the key to stream some of the data through EC2, a Lambda, or other processing methods.\n\nThis tool also offers a simple function for streaming the data once the file catalog is obtained:\n\n```python\ncloudcatalog.CloudCatalog.stream(cloud_catalog, lambda bfile, startdate, stopdate, filesize: print(len(bo.read()), filesize))\n```\n\n### Searching the Entire Catalog\nAs an alternative to manually searching, you can use the EntireCatalogSearch class to find a catalog entry:\n\n```python\nsearch = cloudcatalog.EntireCatalogSearch()\ntop_search_result = search.search_by_keywords(['vector', 'mission', 'useful'])[0]\n# Prints out the top result with all the catalog info, including id, loc, startdate, etc.\nprint(top_search_result)\n```\n\n### Terse example for an SDO fetch of the filelist for all the 94A EUV images (1,624,900 files)\n```\nimport cloudcatalog\ndataid = \"aia_0094\"\ns3bucket=\"s3://gov-nasa-hdrl-data1/\"\nfr = cloudcatalog.CloudCatalog(s3bucket)\nmySDOlist = fr.request_cloud_catalog(dataid,\n\t    start_date=fr.get_entry(dataid)['start'],\n\t    stop_date=fr.get_entry(dataid)['stop'])\n```\n\n### Terse example for an MMS fetch of the filelist for all of a specific MMS item (64,383 files)\n```\nimport cloudcatalog\ndataid = \"mms1_feeps_brst_electron\"\ns3bucket=\"s3://helio-public/\"\nfr = cloudcatalog.CloudCatalog(s3bucket)\nmyMMSlist = fr.request_cloud_catalog(dataid,\n\t    start_date=fr.get_entry(dataid)['start'],\n\t    stop_date=fr.get_entry(dataid)['stop'])\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "API for accessing the generalized Cloud Catalog (cloudcatalog) specification for sharing data in and across clouds",
    "version": "0.6.1",
    "project_urls": {
        "Documentation": "https://github.com/heliocloud-data/cloudcatalog",
        "Homepage": "https://heliocloud.org",
        "Repository": "https://github.com/heliocloud-data/cloudcatalog"
    },
    "split_keywords": [
        "cloud",
        " index",
        " catalog",
        " aws"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3afc5e4638203a7d454efcb5d455ce9eed6d3921d2ced98eb1c2ab88b2815d99",
                "md5": "66ac79615583ad3e2a630ba0a388cb3c",
                "sha256": "7b0fabde601cc9d702dc536e37887f0d9cbe7b9f574836e1e17447931d289f20"
            },
            "downloads": -1,
            "filename": "cloudcatalog-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "66ac79615583ad3e2a630ba0a388cb3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20277,
            "upload_time": "2024-08-21T20:37:43",
            "upload_time_iso_8601": "2024-08-21T20:37:43.705660Z",
            "url": "https://files.pythonhosted.org/packages/3a/fc/5e4638203a7d454efcb5d455ce9eed6d3921d2ced98eb1c2ab88b2815d99/cloudcatalog-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cc2785bda332e29dc552ff5dc5e90650eb171d5ce4ef7fb658a7a7c66401c3f",
                "md5": "e26fb908f84ddd7ae66118541c0b0047",
                "sha256": "87a62a7e0fb80ae226c1f5acd31a6d8ccb8432202095f2cd18475f60b0f05384"
            },
            "downloads": -1,
            "filename": "cloudcatalog-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e26fb908f84ddd7ae66118541c0b0047",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 75289,
            "upload_time": "2024-08-21T20:37:45",
            "upload_time_iso_8601": "2024-08-21T20:37:45.895979Z",
            "url": "https://files.pythonhosted.org/packages/5c/c2/785bda332e29dc552ff5dc5e90650eb171d5ce4ef7fb658a7a7c66401c3f/cloudcatalog-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-21 20:37:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "heliocloud-data",
    "github_project": "cloudcatalog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cloudcatalog"
}
        
Elapsed time: 0.31732s