SWXSOCClient¶
- class swxsoc.net.client.SWXSOCClient[source]¶
Bases:
BaseClientClient for searching for SWXSOC data on AWS. This client provides search and fetch functionality for SWXSOC data and is based on the sunpy BaseClient for FIDO.
For more information on the sunpy BaseClient, see: https://docs.sunpy.org/en/stable/generated/api/sunpy.net.base_client.BaseClient.html
Note that AWS buckets may require access keys.
Examples
>>> from swxsoc.net.attr import AttrAnd, SearchTime, Level, Descriptor, Instrument >>> from swxsoc.net.client import SWXSOCClient >>> from astropy.time import Time >>> client = SWXSOCClient() >>> query = AttrAnd([SearchTime(start=Time("2025-07-10T00:00:00"), end=Time("2025-07-11T00:00:00")), ... Instrument("meddea"), ... Level("l0"), ... Descriptor("housekeeping")]) >>> results = client.search(query)
Attributes Summary
Methods Summary
fetch(query_results, *, path, downloader, ...)Fetches the files based on query results and queues them up to be downloaded to the specified path by your downloader.
generate_prefixes(levels, start_time, ...)Generates a list of prefixes based on the level and time range.
generate_presigned_url(bucket_name, object_key)Generates a presigned URL for accessing an object in S3.
list_files_in_s3(bucket_names)Lists all files in the specified S3 buckets.
search([query])Searches for data based on the given query.
Attributes Documentation
- size_column = 'size'¶
Methods Documentation
- fetch(query_results, *, path, downloader, **kwargs)[source]¶
Fetches the files based on query results and queues them up to be downloaded to the specified path by your downloader.
Note: The downloader must be an instance of parfive.Downloader
- static generate_prefixes(levels: list, start_time: str, end_time: str, descriptor: str) list[source]¶
Generates a list of prefixes based on the level and time range.
- static generate_presigned_url(bucket_name, object_key, expiration=3600)[source]¶
Generates a presigned URL for accessing an object in S3. If credentials are not available or access is denied, attempts an unsigned request for public access.
- Parameters:
- Returns:
str or None – The presigned URL if successful, or a direct unsigned URL if public access is allowed. Otherwise, returns None.
- static list_files_in_s3(bucket_names: list) list[source]¶
Lists all files in the specified S3 buckets. If access is denied, it retries with an unsigned request.
- Parameters:
bucket_names (list) – A list of S3 bucket names.
- Returns:
list – A list of dictionaries containing metadata about each S3 object.