<p>You can use <a href="https://sunpy.org" rel="nofollow noreferrer">SunPy</a>, check the <a href="https://docs.sunpy.org/en/stable/generated/gallery/time_series/goes_xrs_example.html" rel="nofollow noreferrer">Retrieving and analyzing GOES X-Ray Sensor (XRS) data</a> example. There it explains how to download data with a time range and if wanted selecting the GOES satellite number.</p>
<p>If you would like the raw data in csv format, then you can get it from the <a href="https://www.ngdc.noaa.gov/stp/satellite/goes/dataaccess.html" rel="nofollow noreferrer">official archive for GOES data</a>. There you can find full an average data in csv format up to March 4th, 2020 (it stops then because <a href="https://www.ngdc.noaa.gov/stp/satellite/goes-r.html" rel="nofollow noreferrer">GOES 16 and later are part of GOES-R</a>). The link looks like this:</p>
<p><code>https://satdat.ngdc.noaa.gov/sem/goes/data/full/YYYY/MM/goesXX/csv/gXX_xrs_2s_YYYYMMDD_YYYYMMDD.csv</code></p>
<p>Where <code>XX</code> is the satellite number. For example, <a href="https://www.ngdc.noaa.gov/stp/satellite/goes-r.html" rel="nofollow noreferrer">this is the 2s cadence csv file from goes 15 for March 4th, 2021</a>.</p>
<p>For GOES-R I don't believe there's a CSV archive, but <a href="https://sunpy.org" rel="nofollow noreferrer">SunPy</a> can <a href="https://docs.sunpy.org/en/stable/generated/gallery/time_series/goes_xrs_example.html" rel="nofollow noreferrer">query and download it, as shown in the example on the gallery</a>.</p>
<p>Once you donwload the file with SunPy, you can <a href="https://docs.sunpy.org/en/stable/guide/data_types/timeseries.html" rel="nofollow noreferrer">load, plot, manipulate, and convert that timeseries to any other format</a> that <a href="https://docs.astropy.org/en/stable/table/io.html#supported-formats" rel="nofollow noreferrer">astropy tables support</a> (including csv).</p>
<p>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.</p>
<pre><code>from sunpy import timeseries as ts
from sunpy.net import Fido
from sunpy.net import attrs as a

tstart = &quot;2020-06-21 01:00&quot;
tend = &quot;2020-06-21 23:00&quot;
result = Fido.search(a.Time(tstart, tend), a.Instrument(&quot;XRS&quot;), 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')
</code></pre>

CC BY-SA 4.0
2021-11-04T04:26:35.243Z
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](https://en.wikipedia.org/wiki/List_of_GOES_satellites) 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)`.
mikeysflix
CC BY-SA 4.0
2021-11-04T04:28:49.900Z
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](https://github.com/sunpy/sunpy/issues/5661). Any idea how to circumvent this? Ideally, I'd like the full dataset from each GOES satellite.
mikeysflix
CC BY-SA 4.0
2021-11-04T05:18:55.847Z
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.
https://stackoverflow.com/questions/69834781/changing-parameters-in-sunpy-tutorial-throws-an-error-is-this-a-bug
mikeysflix
CC BY-SA 4.0
2021-11-05T15:15:31.817Z
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 ;)
dvdgc13
CC BY-SA 4.0
2021-10-23T09:05:42.677Z
2023-07-30T14:41:22.620Z
2023-07-30T14:41:22.620Z
dvdgc13
<p>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 <a href="https://www.nature.com/articles/s41597-020-0548-x" rel="nofollow noreferrer">this Nature paper</a>).</p>
<p><a href="https://i.sstatic.net/HgxfG.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HgxfG.jpg" alt="enter image description here" /></a></p>
<p>I first tried accessing the <a href="https://www.ngdc.noaa.gov/stp/satellite/goes-r.html" rel="nofollow noreferrer">GOES-R dataset</a>, which contains netcdf (aka .nc) files. I followed the steps in <a href="https://stackoverflow.com/questions/36360469/read-nc-netcdf-files-using-python">this post on stackoverflow</a> but was unable to open any of the netcdf files.</p>
<p>I also tried accessing the flux dataset from <a href="https://www.swpc.noaa.gov/products/goes-x-ray-flux" rel="nofollow noreferrer">NOAA SWPC</a>; I clicked the &quot;data&quot; tab and click the &quot;json&quot; 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 &quot;year&quot;, &quot;month&quot;, and &quot;day&quot;, but not &quot;hour&quot;, &quot;minute&quot;, and &quot;second&quot;.</p>
<p>I notice that most of the data products available are fluxes averaged over a time-interval; I prefer the raw time-series if possible.</p>
<p>I am hopeful that a representation of this dataset exists in the form of a text-file (such as <a href="https://hesperia.gsfc.nasa.gov/hessidata/dbase/hessi_flare_list.txt" rel="nofollow noreferrer">this one provided by RHESSI</a>). 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?</p>
<p>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?</p>

<python><solar-flare><raw-data><flux>
How to access the raw time-series dataset of GOES X-Ray Flux?
mikeysflix
# How to access the raw time-series dataset of GOES X-Ray Flux?

(Asked by: username_0 on 2021-10-23)

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](https://www.nature.com/articles/s41597-020-0548-x)).

[![enter image description here](https://i.sstatic.net/HgxfG.jpg)](https://i.sstatic.net/HgxfG.jpg)

I first tried accessing the [GOES-R dataset](https://www.ngdc.noaa.gov/stp/satellite/goes-r.html), which contains netcdf (aka .nc) files. I followed the steps in [this post on stackoverflow](https://stackoverflow.com/questions/36360469/read-nc-netcdf-files-using-python) but was unable to open any of the netcdf files.

I also tried accessing the flux dataset from [NOAA SWPC](https://www.swpc.noaa.gov/products/goes-x-ray-flux); 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](https://hesperia.gsfc.nasa.gov/hessidata/dbase/hessi_flare_list.txt)). 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?

**Tags:** python, solar-flare, raw-data, flux


---

## 1 answers

### Answer by username_1 on 2021-10-23. Score: 2 | Accepted answer

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')

> **Comments:**
> **username_0**: 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](https://en.wikipedia.org/wiki/List_of_GOES_satellites) 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)`.  
> **username_0**: 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](https://github.com/sunpy/sunpy/issues/5661). Any idea how to circumvent this? Ideally, I'd like the full dataset from each GOES satellite.  
> **username_0**: 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. https://stackoverflow.com/questions/69834781/changing-parameters-in-sunpy-tutorial-throws-an-error-is-this-a-bug  
> **username_1**: 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 ;)  

---

