dace_query.sun package¶
Submodules¶
dace_query.sun.sun module¶
- class dace_query.sun.sun.SunClass(dace_instance: DaceClass | None = None)¶
Bases:
objectThe sun class. Use to retrieve data from the sun module.
A sun instance is already provided, to use it :
>>> from dace_query.sun import Sun
- download(file_type: str, filters: dict | None = None, output_directory: str | None = None, output_filename: str | None = None) None¶
Download Sun spectroscopy products (S1D, S2D, …).
Available file types are [ ‘s1d’, ‘s2d’, ‘ccf’, ‘bis’, ‘all’ ].
- Parameters:
file_type – The type of files to download
filters (Optional[dict]) – Filters to apply to the query
output_directory (Optional[str]) – The directory where files will be saved
output_filename (Optional[str]) – The filename for the download
- Returns:
None
>>> from dace_query.sun import Sun >>> filters_to_use = {'file_rootpath': {'contains': ['r.HARPN.2016-01-03T15-36-20.496.fits']}} >>> # Sun.download('s1d', filters=filters_to_use, output_directory='/tmp', output_filename='sun_spectroscopy_data.tar.gz')
- download_files(file_type: str | None = 's1d', files: list[str] | None = None, output_directory: str | None = None, output_filename: str | None = None) None¶
Download reduction products specified in argument for the list of raw files specified and save it locally.
Available file types are [ ‘s1d’, ‘s2d’, ‘ccf’, ‘bis’, ‘all’ ].
- Parameters:
file_type (Optional[str]) – The type of files to download
files (list[str]) – The raw files
output_directory (Optional[str]) – The directory where files will be saved
output_filename (Optional[str]) – The filename for the download
- Returns:
None
>>> from dace_query.sun import Sun >>> files_to_retrieve = ['harpn/DRS-2.3.5/reduced/2016-01-03/r.HARPN.2016-01-03T15-36-20.496.fits'] >>> # Sun.download_files('s1d', files=files_to_retrieve, output_directory='/tmp', output_filename='files.tar.gz')
- download_public_release_all(year: str, month: str, output_directory: str | None = None, output_filename: str | None = None) None¶
Download public sun data of year and month specified in arguments.
- Parameters:
year (str) – The year for sun data
month (str) – The month for sun data
output_directory (Optional[str]) – The directory where files will be saved
output_filename (Optional[str]) – The filename for the download
- Returns:
None
>>> from dace_query.sun import Sun >>> # Sun.download_public_release_all('2015','12', output_directory='/tmp', output_filename='release_all_2015-12.tar.gz')
- download_public_release_ccf(year: str, output_directory: str | None = None, output_filename: str | None = None) None¶
Download public ccf data realease of year specified in argument.
- Parameters:
year – The year for the ccf data
output_directory (Optional[str]) – The directory where files will be saved
output_filename (Optional[str]) – The filename for the download
- Returns:
None
>>> from dace_query.sun import Sun >>> # Sun.download_public_release_ccf('2015', output_directory='/tmp', output_filename='cff.tar.gz')
- download_public_release_timeseries(period: str | None = '2015-2018', output_directory: str | None = None, output_filename: str | None = None) None¶
Download public timeseries data release for a specified period and save it locally.
The only available period is ‘2015-2018’.
- Parameters:
period (Optional[str]) – The period
output_directory (Optional[str]) – The directory where files will be saved
output_filename (Optional[str]) – The filename for the download
- Returns:
None
>>> from dace_query.sun import Sun >>> # Sun.download_public_release_timeseries(output_directory='/tmp', output_filename='public_release_timeseries.rdb')
- query_database(limit: int | None = 200000, filters: dict | None = None, sort: dict | None = None, output_format: str | None = None)¶
Query the sun database to retrieve data in the chosen format.
Filters and sorting order can be applied to the query via named arguments (see Filtering and sorting).
All available formats are defined in this section (see Output formats).
- Parameters:
limit (Optional[int]) – Maximum number of rows to return
filters (Optional[dict]) – Filters to apply to the query
sort (Optional[dict]) – Sort order to apply to the query
output_format (Optional[str]) – Type of data returns
- Returns:
The desired data in the chosen output format
- Return type:
dict[str, ndarray] or DataFrame or Table or dict
>>> from dace_query.sun import Sun >>> values = Sun.query_database()