Skip to content

Commit

Permalink
Update SUVI locations (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarciabriseno authored Feb 9, 2024
1 parent 0bc1b5a commit 838f5c0
Showing 1 changed file with 7 additions and 32 deletions.
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

0 comments on commit 838f5c0

Please sign in to comment.