Easily searching for multiple wavelengths of data

I’m trying to download a full set of data from SDO/AIA, with one map for each wavelength it observses at (that is optically thin). My current code looks like:

from astropy import time as time
from astropy import units as u
from sunpy.net import Fido, attrs
from sunpy.map import Map
import numpy as np

channels = ["94", "131", "171", "193", "211", "335"]
wlens = [int(c) * u.angstrom for c in channels]

results = Fido.search(
    attrs.Time("2014-01-01 00:00:00", "2014-01-01 00:00:11"),
    attrs.Instrument("AIA"),
    attrs.Wavelength(wlens[0])
    | attrs.Wavelength(wlens[1])
    | attrs.Wavelength(wlens[2])
    | attrs.Wavelength(wlens[3])
    | attrs.Wavelength(wlens[4])
    | attrs.Wavelength(wlens[5]),
)

But the long chaining of OR operators (|) doesn’t look very nice - I was wondering if there was an easier and simpler way to write this code to chain together all the wavelengths with OR?

1 Like

I came across this issue a while ago, and opened this issue to add an example for using the sunpy.net.attr.or_ which can do what you’re looking for

I’ll make a PR to actually make an example now

2 Likes