Repository: sunpy/sunpy

Issue:
GOES/XRS time issue
### Describe the bug

it looks like the way we currently are registering the time array for the GOES XRS data is including leap seconds, however in the data file it ignores it, meaning that the data is currently off by ~27 seconds for GOES 13, 14, 15 for the reprocessed data (as the time is calculated from seconds from 1970-01-01). Its not much of an issue for GOES 16 and 17 as the time is calculated from seconds since 2000-01-01 12:00:00 and hence there are not many leap seconds. 

it is not an issue with the older GOES files (i.e. the fits files from SDAC) see plot:

![Screen Shot 2022-02-24 at 12 23 45](https://user-images.githubusercontent.com/4620298/155515242-3eb30095-0df6-4fc6-942b-1ee6662ee91a.png)


I'll make a PR now to fix this


### To Reproduce

_No response_

### What happened?

_No response_

### Expected behavior

_No response_

### Screenshots

_No response_

### System Details

_No response_

### Installation method

_No response_

Discussion:

Patch:
diff --git a/changelog/5915.bugfix.rst b/changelog/5915.bugfix.rst
new file mode 100644
index 000000000..1ad6e8be5
--- /dev/null
+++ b/changelog/5915.bugfix.rst
@@ -0,0 +1,1 @@
+Fix parsing of the GOES/XRS netcdf files to ignore leap seconds.
diff --git a/sunpy/timeseries/sources/goes.py b/sunpy/timeseries/sources/goes.py
index d8725174d..11a899c01 100644
--- a/sunpy/timeseries/sources/goes.py
+++ b/sunpy/timeseries/sources/goes.py
@@ -257,12 +257,14 @@ class XRSTimeSeries(GenericTimeSeries):
             if "a_flux" in d.variables:
                 xrsa = np.array(d["a_flux"])
                 xrsb = np.array(d["b_flux"])
+
                 start_time_str = d["time"].attrs["units"]
                 if not isinstance(start_time_str, str):
                     # For h5netcdf<0.14
                     start_time_str = start_time_str.astype(str)
                 start_time_str = start_time_str.lstrip("seconds since").rstrip("UTC")
-                times = parse_time(start_time_str) + TimeDelta(d["time"], format="sec")
+                # Perform the time addition in UTime format to ignore leap seconds
+                times = Time(parse_time(start_time_str).utime + d["time"], format="utime")
             elif "xrsa_flux" in d.variables:
                 xrsa = np.array(d["xrsa_flux"])
                 xrsb = np.array(d["xrsb_flux"])
@@ -271,7 +273,8 @@ class XRSTimeSeries(GenericTimeSeries):
                     # For h5netcdf<0.14
                     start_time_str = start_time_str.astype(str)
                 start_time_str = start_time_str.lstrip("seconds since")
-                times = parse_time(start_time_str) + TimeDelta(d["time"], format="sec")
+                # Perform the time addition in UTime format to ignore leap seconds
+                times = Time(parse_time(start_time_str).utime + d["time"], format="utime")
 
             else:
                 raise ValueError(f"The file {filepath} doesn't seem to be a GOES netcdf file.")


Test patch:
diff --git a/sunpy/timeseries/sources/tests/test_goes.py b/sunpy/timeseries/sources/tests/test_goes.py
index ba209501e..702f88855 100644
--- a/sunpy/timeseries/sources/tests/test_goes.py
+++ b/sunpy/timeseries/sources/tests/test_goes.py
@@ -82,6 +82,18 @@ def test_new_goes16():
     assert isinstance(ts_goes, sunpy.timeseries.sources.goes.XRSTimeSeries)
 
 
+def test_goes_netcdf_time_parsing15():
+    # testing to make sure the time is correctly parsed (to ignore leap seconds)
+    ts_goes = sunpy.timeseries.TimeSeries(new_goes15_filepath, source="XRS")
+    assert ts_goes.index[0].strftime("%Y-%m-%d %H:%M:%S.%f") == '2013-10-28 00:00:01.385000'
+
+
+def test_goes_netcdf_time_parsing17():
+    # testing to make sure the time is correctly parsed (to ignore leap seconds)
+    ts_goes = sunpy.timeseries.TimeSeries(new_goes17_filepath, source="XRS")
+    assert ts_goes.index[0].strftime("%Y-%m-%d %H:%M:%S.%f") == '2020-10-16 00:00:00.476771'
+
+
 @pytest.mark.remote_data
 def test_goes_remote():
     # Older format file