# Finding SHARP Number from the NOAA AR Number

**URL:** <https://community.openastronomy.org/t/finding-sharp-number-from-the-noaa-ar-number/465>\
**Category:** SunPy\
**Tags:** sunpy, question\
**Created:** [October 1, 2022, 12:50am UTC](https://community.openastronomy.org/t/finding-sharp-number-from-the-noaa-ar-number/465 "2022-10-01T00:50:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhou](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jhou](https://community.openastronomy.org/u/jhou)\
**Post date:** [October 1, 2022, 12:50am UTC](https://community.openastronomy.org/t/finding-sharp-number-from-the-noaa-ar-number/465/1 "2022-10-01T00:50:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![alasdairwilson](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/alasdairwilson/32/256_2.png) [@alasdairwilson](https://community.openastronomy.org/u/alasdairwilson)\
**Post date:** [October 3, 2022, 1:49pm UTC](https://community.openastronomy.org/t/finding-sharp-number-from-the-noaa-ar-number/465/2 "2022-10-03T13:49:51Z")

</div>

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:

```auto
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:

```auto
   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]`

```auto
                                 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

```auto
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()

```

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/openastronomy/original/1X/f8354b233f63bc945413fdff00fc72260762bb71.jpeg)

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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![TEB](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TEB](https://community.openastronomy.org/u/TEB)\
**Post date:** [November 14, 2022, 4:44pm UTC](https://community.openastronomy.org/t/finding-sharp-number-from-the-noaa-ar-number/465/3 "2022-11-14T16:44:56Z")

</div>

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](http://jsoc.stanford.edu/doc/data/hmi/harpnum_to_noaa/all_harps_with_noaa_ars.txt)
