Skip to content

Commit

Permalink
add: example docs for solo
Browse files Browse the repository at this point in the history
  • Loading branch information
nkasmanoff committed Nov 28, 2023
1 parent 2f69811 commit baa2029
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion helio_tools/_src/data/solo/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
Script to download data products from the SolO database using Fido, a sunpy module meant for retrieving data from solar missions.
In this case it is downloading images from the EUI (extreme ultraviolet imager) from the Solar Orbiter (SolO) mission.
"""
import argparse
import logging
import os
Expand Down Expand Up @@ -26,7 +32,7 @@
class SOLODownloader:

def __init__(self, base_path: str = None,
wavelengths: list[str | int | float] = DEFAULT_WAVELENGTHS, ) -> None:
wavelengths: list[str | int | float] = DEFAULT_WAVELENGTHS) -> None:
self.base_path = base_path
self.wavelengths = wavelengths

Expand All @@ -35,6 +41,17 @@ def __init__(self, base_path: str = None,
for wl in self.wavelengths]

def downloadDate(self, date: datetime):
"""Download FITS data for a specific date.
Args:
date (datetime): date to download
Example Usage:
>>> downloader_solo = SOLODownloader(...)
>>> downloader_solo.downloadDate(datetime(2022, 3, 1))
"""
files = []
try:
# Download FSI Sensor data
Expand All @@ -49,6 +66,21 @@ def downloadDate(self, date: datetime):
[os.remove(f) for f in files if os.path.exists(f)]

def downloadFSI(self, query_date, wl):
"""
Download FSI (full sun) data for a specific date.
Args:
query_date (datetime): date to download
wl (str): wavelength to download
Returns:
file_path (str): path to downloaded file
Example Usage:
>>> downloader_solo = SOLODownloader(...)
>>> downloader_solo.downloadFSI(datetime(2022, 3, 1), 'eui-fsi174-image')
"""
file_path = os.path.join(self.base_path, wl, "%s.fits" %
query_date.isoformat("T", timespec='seconds'))
if os.path.exists(file_path):
Expand Down Expand Up @@ -80,6 +112,9 @@ def downloadFSI(self, query_date, wl):
(query_date.isoformat(), wl))

def downloadHRI(self, query_date, wl):
"""
Currently unused, but retriever for HRI (high res) data
"""
file_path = os.path.join(self.base_path, wl, "%s.fits" %
query_date.isoformat("T", timespec='seconds'))
if os.path.exists(file_path):
Expand Down

0 comments on commit baa2029

Please # to comment.