# How to access the raw time-series dataset of GOES X-Ray Flux?

I would like to access the time-series dataset of X-Ray Flux obtained by GOES. I expect that the flux units to be Watts / square-meter; this is because of the figure below (obtained from this Nature paper).

I first tried accessing the GOES-R dataset, which contains netcdf (aka .nc) files. I followed the steps in this post on stackoverflow but was unable to open any of the netcdf files.

I also tried accessing the flux dataset from NOAA SWPC; I clicked the "data" tab and click the "json" link, but this only contains data from the last week or so. I prefer to have the full dataset spanning a few decades. The same site hosts an FTP link; the text files present here have data fields for "year", "month", and "day", but not "hour", "minute", and "second".

I notice that most of the data products available are fluxes averaged over a time-interval; I prefer the raw time-series if possible.

I am hopeful that a representation of this dataset exists in the form of a text-file (such as this one provided by RHESSI). Regardless, I am not sure how to access this dataset. I wonder if the data I am seeking is in the netcdf files that I am unable to open, or if there is another way to do this - perhaps with astroquery or astropy?

TLDR: I am looking for the GOES dataset containing the time-series (containing year, month, day, hour, minute, and second) of flux (measured as Watts / square-meter). How can I access this raw data?

You can use SunPy, check the Retrieving and analyzing GOES X-Ray Sensor (XRS) data example. There it explains how to download data with a time range and if wanted selecting the GOES satellite number.

If you would like the raw data in csv format, then you can get it from the official archive for GOES data. There you can find full an average data in csv format up to March 4th, 2020 (it stops then because GOES 16 and later are part of GOES-R). The link looks like this:

https://satdat.ngdc.noaa.gov/sem/goes/data/full/YYYY/MM/goesXX/csv/gXX_xrs_2s_YYYYMMDD_YYYYMMDD.csv

Where XX is the satellite number. For example, this is the 2s cadence csv file from goes 15 for March 4th, 2021.

For GOES-R I don't believe there's a CSV archive, but SunPy can query and download it, as shown in the example on the gallery.

Once you donwload the file with SunPy, you can load, plot, manipulate, and convert that timeseries to any other format that astropy tables support (including csv).

This is an example on how to query the data and convert it into csv. This is only for one day, but you could extended to a different time range if wanted.

from sunpy import timeseries as ts
from sunpy.net import Fido
from sunpy.net import attrs as a

tstart = "2020-06-21 01:00"
tend = "2020-06-21 23:00"
result = Fido.search(a.Time(tstart, tend), a.Instrument("XRS"), a.goes.SatelliteNumber(16))
goes_16_files = Fido.fetch(result)
goes_16 = ts.TimeSeries(goes_16_files, concat=True)
goes_table = goes_16.to_table()
goes_table.write('goes_16_20200621.csv', format='csv')

• The code snippet works as is for an old version of sunpy (one point something). Since updating to sunpy 3.0.1, tstart and tend are required to be datetime objects (as opposed to string representations). But, both old and updated versions are throwing the same error when changing the time range. Using wiki as a source for GOES-16 (and adding import datetime at the top of the code), I define tstart = datetime.datetime(2017, 1, 15, 23, 59) and tend = datetime.datetime(2020, 6, 21, 23). Nov 4 at 4:26
• The error that is raised is shown below: goes_table = goes_16.to_table() AttributeError: 'list' object has no attribute 'to_table' I wonder if this is related to recent issues on their github. Any idea how to circumvent this? Ideally, I'd like the full dataset from each GOES satellite. Nov 4 at 4:28
• I think this is more of a stackoverflow question than an astronomy question. I have reformulated the question here - if you have the time, please take a look. stackoverflow.com/questions/69834781/… Nov 4 at 5:18
• Yes, as it's being pointed in stackoverflow, my example was only for one day, which is only a single file (I should have mentioned it!). Glad you found the answer ;) Nov 5 at 15:15