Repository: sunpy/sunpy

Issue:
GOES XRS observatory attribute not parsing correctly
### Describe the bug

another GOES/XRS issue ...

For the GOES 13,14, 15, from what I can tell the meta information within the netcdf file does not include the GOES Satellite Number but rather gives 'GOES 1-15 X-ray Irradiance Sensor (XRS)'. The way we are parsing out the `observatory` attribute is just to read this as GOES-15 but this is the same for GOES 13 and 14. 

Hence if you read in the GOES 13 or 14 data the `observatory` attribute will give you `GOES-15`.
This is an issue for the temperature/emission measure calculation (that will very soon be PR'd to sunkit-instruments) needs to know the satellite to use the correct response. 

(not an issue for GOES 16 and 17).

### To Reproduce


```python
>>> goes_15 = ts.TimeSeries("sci_gxrs-l2-irrad_g15_d20190301_v0-0-0.nc")
>>> goes_14 = ts.TimeSeries("sci_gxrs-l2-irrad_g14_d20190301_v0-0-0.nc")


>>> goes_15.observatory
'GOES-15'
>>> goes_14.observatory 
'GOES-15'
```

I think the only way to go around this is to take the satellite number from the file name itself (for GOES 13, 14, 15).





Discussion:
This definitely worked at some point, maybe it broke before it was merged? There are multiple choices for what meta info to use here: 

        pattern_new = ("{}sci_gxrs-l2-irrad_g{SatelliteNumber:02d}_d{year:4d}{month:2d}{day:2d}_{}.nc{}")
        
Is how that era of goes was supposed to be matched but it looks like maybe the order at which the metadata was checked has been changed. I can take a look at it?
yeah so it looks like it pulls the `id`  from the meta here:

https://github.com/sunpy/sunpy/blob/main/sunpy/timeseries/sources/goes.py#L133

so that it reads from the netcdf attribute `instrument` which is `GOES 1-15 X-ray Irradiance Sensor (XRS)` and then hence uses the pattern 

`pattern_inst = ("GOES 1-{SatelliteNumber:02d} {}")` which return 15


But yes please have a look for sure! 

Resolving patch:
diff --git a/sunpy/timeseries/sources/goes.py b/sunpy/timeseries/sources/goes.py
--- a/sunpy/timeseries/sources/goes.py
+++ b/sunpy/timeseries/sources/goes.py
@@ -123,12 +123,14 @@ def observatory(self):
         pattern_new = ("sci_gxrs-l2-irrad_g{SatelliteNumber:02d}_d{year:4d}{month:2d}{day:2d}_{}.nc")
         pattern_old = ("go{SatelliteNumber:02d}{}{month:2d}{day:2d}.fits")
         pattern_r = ("sci_xrsf-l2-flx1s_g{SatelliteNumber:02d}_d{year:4d}{month:2d}{day:2d}_{}.nc")
+        pattern_1m = ("sci_xrsf-l2-avg1m_g{SatelliteNumber:02d}_d{year:4d}{month:2d}{day:2d}_{}.nc")
         pattern_telescop = ("GOES {SatelliteNumber:02d}")
         # The ordering of where we get the metadata from is important.
         # We alway want to check ID first as that will most likely have the correct information.
         # The other fields are fallback and sometimes have data in them that is "useless".
         id = (
             self.meta.metas[0].get("id", "").strip()
+            or self.meta.metas[0].get("filename_id", "").strip()
             or self.meta.metas[0].get("TELESCOP", "").strip()
             or self.meta.metas[0].get("Instrument", "").strip()
         )
@@ -138,7 +140,7 @@ def observatory(self):
         if id is None:
             log.debug("Unable to get a satellite number from 'Instrument', 'TELESCOP' or 'id' ")
             return None
-        for pattern in [pattern_inst, pattern_new, pattern_old, pattern_r, pattern_telescop]:
+        for pattern in [pattern_inst, pattern_new, pattern_old, pattern_r, pattern_1m, pattern_telescop]:
             parsed = parse(pattern, id)
             if parsed is not None:
                 return f"GOES-{parsed['SatelliteNumber']}"
@@ -228,6 +230,8 @@ def _parse_netcdf(filepath):
         """
         with h5netcdf.File(filepath, mode="r", **XRSTimeSeries._netcdf_read_kw) as h5nc:
             header = MetaDict(OrderedDict(h5nc.attrs))
+            if len(header["id"].strip()) == 0:  # needed to get observatory number if 'id' empty.
+                header.update({"filename_id": Path(filepath).name})
             flux_name = h5nc.variables.get("a_flux") or h5nc.variables.get("xrsa_flux")
             if flux_name is None:
                 raise ValueError(f"No flux data (either a_flux or xrsa_flux) found in file: {filepath}")


Test patch:
diff --git a/sunpy/data/test/goes_truncated_test_goes13.nc b/sunpy/data/test/sci_gxrs-l2-irrad_g13_d20170901_truncated.nc
similarity index 100%
rename from sunpy/data/test/goes_truncated_test_goes13.nc
rename to sunpy/data/test/sci_gxrs-l2-irrad_g13_d20170901_truncated.nc
diff --git a/sunpy/data/test/goes_truncated_test_goes15.nc b/sunpy/data/test/sci_gxrs-l2-irrad_g15_d20131028_truncated.nc
similarity index 100%
rename from sunpy/data/test/goes_truncated_test_goes15.nc
rename to sunpy/data/test/sci_gxrs-l2-irrad_g15_d20131028_truncated.nc
diff --git a/sunpy/data/test/goes_truncated_test_1m_avg_goes15.nc b/sunpy/data/test/sci_xrsf-l2-avg1m_g15_d20190102_truncated.nc
similarity index 100%
rename from sunpy/data/test/goes_truncated_test_1m_avg_goes15.nc
rename to sunpy/data/test/sci_xrsf-l2-avg1m_g15_d20190102_truncated.nc
diff --git a/sunpy/data/test/goes_truncated_test_1m_avg_goes16.nc b/sunpy/data/test/sci_xrsf-l2-avg1m_g16_d20210101_truncated.nc
similarity index 100%
rename from sunpy/data/test/goes_truncated_test_1m_avg_goes16.nc
rename to sunpy/data/test/sci_xrsf-l2-avg1m_g16_d20210101_truncated.nc
diff --git a/sunpy/data/test/goes_truncated_test_goes17.nc b/sunpy/data/test/sci_xrsf-l2-flx1s_g17_d20201016_truncated.nc
similarity index 100%
rename from sunpy/data/test/goes_truncated_test_goes17.nc
rename to sunpy/data/test/sci_xrsf-l2-flx1s_g17_d20201016_truncated.nc
diff --git a/sunpy/timeseries/sources/tests/test_goes.py b/sunpy/timeseries/sources/tests/test_goes.py
--- a/sunpy/timeseries/sources/tests/test_goes.py
+++ b/sunpy/timeseries/sources/tests/test_goes.py
@@ -9,11 +9,11 @@
 from sunpy.util.exceptions import SunpyUserWarning
 
 goes_fits_filepath_com = get_test_filepath('go1520120601.fits.gz')
-goes13_filepath_nc = get_test_filepath('goes_truncated_test_goes13.nc')
-goes15_filepath_nc = get_test_filepath('goes_truncated_test_goes15.nc')
-goes17_filepath_nc = get_test_filepath('goes_truncated_test_goes17.nc')
-goes15_1m_avg_filepath = get_test_filepath('goes_truncated_test_1m_avg_goes15.nc')
-goes16_1m_avg_filepath = get_test_filepath('goes_truncated_test_1m_avg_goes16.nc')
+goes13_filepath_nc = get_test_filepath('sci_gxrs-l2-irrad_g13_d20170901_truncated.nc')
+goes15_filepath_nc = get_test_filepath('sci_gxrs-l2-irrad_g15_d20131028_truncated.nc')
+goes17_filepath_nc = get_test_filepath('sci_xrsf-l2-flx1s_g17_d20201016_truncated.nc')
+goes15_1m_avg_filepath = get_test_filepath('sci_xrsf-l2-avg1m_g15_d20190102_truncated.nc')
+goes16_1m_avg_filepath = get_test_filepath('sci_xrsf-l2-avg1m_g16_d20210101_truncated.nc')
 goes13_leap_second_filepath = get_test_filepath('goes_13_leap_second.nc')
 
 
@@ -37,7 +37,6 @@ def test_implicit_goes(goes_nc_files):
                           (goes17_filepath_nc, 'GOES-17'),
                           (goes15_1m_avg_filepath, 'GOES-15'),
                           (goes16_1m_avg_filepath, 'GOES-16')])
-@pytest.mark.xfail
 def test_implicit_goes_satno(goes_nc_files, sat_no):
     # Test that satellite number is correctly parsed from files
     ts_goes = sunpy.timeseries.TimeSeries(goes_nc_files, source='XRS')