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

Update SUVI locations #351

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 7 additions & 32 deletions install/helioviewer/hvpull/servers/suvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,20 @@
class SUVIDataServer(DataServer):
"""GOES/SUVI Datasource definition"""
def __init__(self):
"""Defines the root directory of where the data is kept at LMSAL."""
DataServer.__init__(self, "http://swhv.oma.be/jp2/SUVI/", "SUVI")
"""Defines the root directory of where the data is kept at ROB."""
DataServer.__init__(self, "http://swhv.oma.be/jp2/", "SUVI")

def compute_directories(self, start_date, end_date):
"""Computes a list of remote directories expected to contain files"""
dirs = []

wavelengths = [93, 131, 171, 195, 284, 303]
wavelengths = ["fe094", "fe131", "fe171", "fe195", "fe284", "he303"]
# prefix each type with suvi_ to create the folder name
wavelengths = map(lambda t: f"suvi_{t}", wavelengths)

dates = self.get_dates(start_date, end_date)
months = self._get_months(dates)
for month in months:
for date in dates:
for wavelength in wavelengths:
# Special case: 195 and 303 have some files outside of the year folder.
if (wavelength == 195 or wavelength == 303):
dirs.append(os.path.join(self.uri, str(wavelength)))

# Besides those special cases above, the files follow a regular directory structure.
dirs.append(os.path.join(self.uri, str(wavelength), month))
dirs.append(os.path.join(self.uri, wavelength, date))

return dirs

def _get_months(self, dates):
"""
Reduce dates into a list of year/month
For example a list such as [2022/08/01, 2022/08/02] will turn into [2022/08]

The SUVI directory structure doesn't have folders for days.
"""
months = []
for date in dates:
# split the year/month/day into individual parts
year, month, day = date.split('/')
# Rebuild date with just the year/month
year_month = year + '/' + month
# Check if its already in our months array
if (year_month not in months):
# If not, then add it.
months.append(year_month)
# Return the collection of months without days.
return months

Loading