Finding SHARP Number from the NOAA AR Number

I know that JSOC magnetogram FITS files contain the NOAA number in the header, but is there a way to access the SHARP Number from a known NOAA AR Number?

Thanks!

1 Like

So this isn’t too bad too do I think.

You can search the sharp series on drms and return the fits header that you are interested in (you can get whatever but you need both HARPNUM and NOAA_ARS) like so:

from sunpy.net.jsoc.jsoc import drms
client = drms.Client()
harp = client.query('hmi.sharp_720s[][2022.01.01_00:00_TAI]', key = ['HARPNUM','T_REC','NOAA_ARS'])

which returns a list of all the harp patches for that day and the associated header data:

   HARPNUM                    T_REC NOAA_ARS
0     7890  2022.01.01_00:00:00_TAI    12916
1     7891  2022.01.01_00:00:00_TAI    12918
2     7896  2022.01.01_00:00:00_TAI    12919
3     7905  2022.01.01_00:00:00_TAI  MISSING
4     7912  2022.01.01_00:00:00_TAI    12923
5     7913  2022.01.01_00:00:00_TAI    12922
6     7915  2022.01.01_00:00:00_TAI  MISSING

You can then filter that dataframe in some way by whatever noaa_number you are interested in, e.g. if you wanted 12916:

harpnum = harp['HARPNUM'][harp['NOAA_ARS'] == '12916'].values

(Note that NOAA_ARS is a column separated list of all the ars that the patch is associated with and so == won’t work if multiple noaa numbers are there, use contains instead but I was being lazy here)

And if you want then you can get the url if you want to download just the segments that are associated with that noaa_number:

fname = [client.query(f'hmi.sharp_720s[{h}][2022.01.01_00:00_TAI]', seg='Continuum') for h in harpnum]

                                 Continuum
0  /SUM4/D1485071379/S00000/continuum.fits

Or preferably you could use Fido to search for the file (again optionally filtered by segments) as this will get you the header data necessary to use sunpy.Map

from sunpy.net import Fido, attrs as a
from sunpy.map import Map
query =  Fido.search(a.Time('2022/01/01T00:00:00','2022/01/01T00:00:00'), a.jsoc.Series.hmi_sharp_720s, jsat.Keyword('HARPNUM') == 7890, a.jsoc.Notify('your@email.here'), a.jsoc.Segment('continuum'))

file = Fido.fetch(query)

m = Map(file)

m.peek()

Of course, you could do the entire search in Fido but I think there might be an issue due to NOAA_ARS versus NOAA_AR, I don’t believe it is possible to search for keyword contains 12916 so while you could do:

query =  Fido.search(a.Time('2022/01/01T00:00:00','2022/01/01T00:00:00'), a.jsoc.Series.hmi_sharp_720s, a.jsoc.Keyword('NOAA_AR') == 12916, a.jsoc.Notify('your@email.here'), a.jsoc.Segment('continuum'))

Which would work equivalently in this example, if you had a harp with NOAA_ARS = 12915,12916 then this would not be included. These patches which correspond to multiple noaa defined ars are actually pretty common.

Hopefully that helps you!

3 Likes

There’s also the handy text file maintained at the JSOC:

http://jsoc.stanford.edu/doc/data/hmi/harpnum_to_noaa/all_harps_with_noaa_ars.txt

1 Like