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

Add multiple SSW mirrors #322

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions aiapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -23,4 +26,4 @@ def _get_bibtex():


__citation__ = __bibtex__ = _get_bibtex()
__all__ = ["__version__", "__citation__", "_SSW_MIRROR"]
__all__ = ["__version__", "__citation__", "_SSW_MIRRORS"]
2 changes: 1 addition & 1 deletion aiapy/calibrate/uncertainty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://sohoftp.nascom.nasa.gov/solarsoft/sdo/aia/idl/response/aia_bp_estimate_error.pro>`_
`aia_bp_estimate_error.pro <https://sohoftp.nascom.nasa.gov/solarsoft/sdo/aia/idl/response/aia_bp_estimate_error.pro>`_
routine in SolarSoft.

Parameters
Expand Down
10 changes: 4 additions & 6 deletions aiapy/calibrate/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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

Expand All @@ -24,19 +24,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",
),
}
Expand Down
14 changes: 4 additions & 10 deletions aiapy/response/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
),
},
Expand Down
1 change: 1 addition & 0 deletions changelog/322.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed incorrect IDL routine reference in the `aiapy.calibrate.uncertainty.estimate_error` documentation.
1 change: 1 addition & 0 deletions changelog/322.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added extra mirrors to fetch files from SSW.