From 93e4623e403ef0b1d2ace4b9fda9c7d9f97df2f6 Mon Sep 17 00:00:00 2001 From: Will Barnes Date: Mon, 18 Dec 2023 15:38:04 -0800 Subject: [PATCH] Add multiple SSW mirrors (#322) Fixes #320 Fixes #126 --------- Co-authored-by: Nabil Freij --- aiapy/__init__.py | 7 +++++-- aiapy/calibrate/uncertainty.py | 2 +- aiapy/calibrate/util.py | 10 ++++------ aiapy/response/channel.py | 14 ++++---------- changelog/322.doc.rst | 1 + changelog/322.feature.rst | 1 + 6 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 changelog/322.doc.rst create mode 100644 changelog/322.feature.rst diff --git a/aiapy/__init__.py b/aiapy/__init__.py index 1eb0a5c..86e5839 100644 --- a/aiapy/__init__.py +++ b/aiapy/__init__.py @@ -3,7 +3,10 @@ from .version import version as __version__ -_SSW_MIRROR = "https://sohoftp.nascom.nasa.gov/solarsoft/" +_SSW_MIRRORS = [ + "https://soho.nascom.nasa.gov/solarsoft/", + "https://hesperia.gsfc.nasa.gov/ssw/", +] def _get_bibtex(): @@ -23,4 +26,4 @@ def _get_bibtex(): __citation__ = __bibtex__ = _get_bibtex() -__all__ = ["__version__", "__citation__", "_SSW_MIRROR"] +__all__ = ["__version__", "__citation__", "_SSW_MIRRORS"] diff --git a/aiapy/calibrate/uncertainty.py b/aiapy/calibrate/uncertainty.py index 42e4c08..50d4f15 100644 --- a/aiapy/calibrate/uncertainty.py +++ b/aiapy/calibrate/uncertainty.py @@ -34,7 +34,7 @@ def estimate_error( contributions from the photometric calibration and errors in the atomic data. .. note:: This function is adapted directly from the - `aia_bp_corrections.pro `_ + `aia_bp_estimate_error.pro `_ routine in SolarSoft. Parameters diff --git a/aiapy/calibrate/util.py b/aiapy/calibrate/util.py index 9f500af..9abd126 100644 --- a/aiapy/calibrate/util.py +++ b/aiapy/calibrate/util.py @@ -16,7 +16,7 @@ from sunpy.data import manager from sunpy.net import attrs, jsoc -from aiapy import _SSW_MIRROR +from aiapy import _SSW_MIRRORS from aiapy.util.decorators import validate_channel from aiapy.util.exceptions import AiapyUserWarning @@ -26,19 +26,17 @@ # This needs to be incremented as the calibration is updated in JSOC. CALIBRATION_VERSION = 10 # Error table filename available from SSW -AIA_ERROR_FILE = urljoin(_SSW_MIRROR, "sdo/aia/response/aia_V{}_error_table.txt") +AIA_ERROR_FILE = "sdo/aia/response/aia_V{}_error_table.txt" # Most recent version number for error tables; increment as new versions become available ERROR_VERSION = 3 # URLs and SHA-256 hashes for each version of the error tables -# The URLs are left as a list so that possible mirrors for these files -# can be specified URL_HASH = { 2: ( - (AIA_ERROR_FILE.format(2)), + [urljoin(mirror, AIA_ERROR_FILE.format(2)) for mirror in _SSW_MIRRORS], "ac97ccc48057809723c27e3ef290c7d78ee35791d9054b2188baecfb5c290d0a", ), 3: ( - (AIA_ERROR_FILE.format(3)), + [urljoin(mirror, AIA_ERROR_FILE.format(3)) for mirror in _SSW_MIRRORS], "66ff034923bb0fd1ad20e8f30c7d909e1a80745063957dd6010f81331acaf894", ), } diff --git a/aiapy/response/channel.py b/aiapy/response/channel.py index 2aced04..f084a36 100644 --- a/aiapy/response/channel.py +++ b/aiapy/response/channel.py @@ -11,7 +11,7 @@ from sunpy.io.special import read_genx from sunpy.util.metadata import MetaDict -from aiapy import _SSW_MIRROR +from aiapy import _SSW_MIRRORS from aiapy.calibrate import degradation from aiapy.calibrate.util import _select_epoch_from_correction_table, get_correction_table from aiapy.util import telescope_number @@ -20,23 +20,17 @@ __all__ = ["Channel"] # TODO: Work out what changes with version. -AIA_INSTRUMENT_FILE = urljoin(_SSW_MIRROR, "sdo/aia/response/aia_V{}_{}_fullinst.genx") +AIA_INSTRUMENT_FILE = "sdo/aia/response/aia_V{}_{}_fullinst.genx" VERSION_NUMBER = 8 # Most recent version number for instrument response data # URLs and SHA-256 hashes for each version for the EUV and FUV files -# The URLs are left as a list so that possible mirrors for these files -# can be specified URL_HASH = { - 2: {"fuv": None, "euv": None}, - 3: {"fuv": None, "euv": None}, - 4: {"fuv": None, "euv": None}, - 6: {"fuv": None, "euv": None}, 8: { "fuv": ( - (AIA_INSTRUMENT_FILE.format(VERSION_NUMBER, "fuv")), + [urljoin(mirror, AIA_INSTRUMENT_FILE.format(VERSION_NUMBER, "fuv")) for mirror in _SSW_MIRRORS], "8635166d8f6dde48da4f135925f4e8f48a0574f129c2c2ca24da6628550f5430", ), "euv": ( - (AIA_INSTRUMENT_FILE.format(VERSION_NUMBER, "all"),), + [urljoin(mirror, AIA_INSTRUMENT_FILE.format(VERSION_NUMBER, "all")) for mirror in _SSW_MIRRORS], "3940648e6b02876c45a9893f40806bbcc50baa994ae3fa2d95148916988426dd", ), }, diff --git a/changelog/322.doc.rst b/changelog/322.doc.rst new file mode 100644 index 0000000..deddb56 --- /dev/null +++ b/changelog/322.doc.rst @@ -0,0 +1 @@ +Fixed incorrect IDL routine reference in the `aiapy.calibrate.uncertainty.estimate_error` documentation. diff --git a/changelog/322.feature.rst b/changelog/322.feature.rst new file mode 100644 index 0000000..90e6fe7 --- /dev/null +++ b/changelog/322.feature.rst @@ -0,0 +1 @@ +Added extra mirrors to fetch files from SSW.