Wolfram Research

Function Repository Resource:

SpaceWeatherData

Source Notebook

Give time-dependent data for a variety of space weather properties

Contributed by: Jeff Bryant

ResourceFunction["SpaceWeatherData"]["Properties"]

gives a list of properties that are available.

ResourceFunction["SpaceWeatherData"][prop]

gives a property association of the most recent values of all available properties.

ResourceFunction["SpaceWeatherData"][date,prop]

gives either a value or values of the specifed property on the specified date.

ResourceFunction["SpaceWeatherData"][{startdate,enddate},prop]

gives the value or values of the property between startdate and enddate.

Details and Options

Space weather is a collection of phenomena that describe the interaction between the Earth and Sun, typically related to energetic events such as solar flares originating from areas with sunspots, as well as the solar wind and its effects on the Earth's magnetic field and atmosphere. Space weather has direct influences on power grids, spacecraft operations and communication, as well as the safety of astronauts due to radiation exposure.
Requires network connectivity.
The range of dates over which data is available varies depending on the property.
The time resolution of the data varies depending on the property.
For data that has time resolution of a day or less, the times are given in GMT.
Date specifications that result in a single value will return that single value; otherwise a TimeSeries will be returned.
The following properties are available:
“DailySunspotNumber” daily sunspot number
“IMFBMagnitude” magnitude of the interplanetary magnetic field
“IMFBx” x component of the interplanetary magnetic field
“IMFBy” y component of the interplanetary magnetic field
“IMFBz” z component of the interplanetary magnetic field
“LongSolarXRayFlux” solar x-ray flux (0.1–0.8 nm)
“MonthlySunspotNumber” monthly averaged sunspot number
“PlanetaryKIndex” planetary K‐index
“ShortSolarXRayFlux” solar x-ray flux (0.05–0.4 nm)
“SolarWindBulkSpeed” bulk speed of the solar wind
“SolarWindIonTemperature” ion temperature of the solar wind
“SolarWindProtonDensity” proton density of the solar wind
“TenDotSevenCMSolarRadioFlux” solar radio flux at 10.7 cm wavelength
“YearlySunspotNumber” yearly averaged sunspot number

Examples

Basic Examples

List all available properties:

In[1]:=
ResourceFunction["SpaceWeatherData"]["Properties"]
Out[1]=

Get an Association of the most recent values:

In[2]:=
ResourceFunction["SpaceWeatherData"][]
Out[2]=

Obtain the most recent daily sunspot number:

In[3]:=
ResourceFunction["SpaceWeatherData"]["DailySunspotNumber"]
Out[3]=

Obtain a time series of the yearly averaged sunspot number since 1611:

In[4]:=
ResourceFunction[
 "SpaceWeatherData"][{DateObject[{1611}], DateObject[{2018}]}, "YearlySunspotNumber"]
Out[4]=

Scope

Sunspots

Sunspots are measured using a “number” that correlates to a “count” but is not directly equal to the number of sunspots one would expect to see. You can divide the number by 15 to get an approximate idea of how many sunspots might have been visible to the naked eye at the time of the query. Data is available at different temporal resolutions: a daily value, a monthly averaged value and a yearly averaged value. It represents the “international sunspot number” issued by the Royal Observatory of Belgium.

Find the current daily sunspot number:

In[5]:=
ResourceFunction["SpaceWeatherData"]["DailySunspotNumber"]
Out[5]=

Find the current monthly averaged sunspot number:

In[6]:=
ResourceFunction["SpaceWeatherData"][
 DateObject[{2013, 3}], "MonthlySunspotNumber"]
Out[6]=

Find the current yearly averaged sunspot number:

In[7]:=
ResourceFunction["SpaceWeatherData"][
 DateObject[{2013}], "YearlySunspotNumber"]
Out[7]=

The yearly averaged value allows you to see the 11‐year sunspot cycle going all the way back to 1611. Of particular interest is the Maunder Minimum (orange) prior to 1700, where the sunspot cycle seemed to stop for a number of years. Another event, the Dalton Minimum (green), happened between about 1790 and 1830, and showed a reduced period of solar variability of sunspots. The Modern Maximum lasted between approximately 1915 and 2000, with the end in question, as it may extend into the latest sunspot cycle:

In[8]:=
annualsunspotts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{1611}], DateObject[{2018}]}, "YearlySunspotNumber"]
Out[8]=
In[9]:=
DateListPlot[annualsunspotts, FrameLabel -> {None, Automatic}, Epilog -> {Orange, Opacity[.2], Rectangle[{AbsoluteTime[{1645}], 0}, {AbsoluteTime[{1715}], 300}], Green, Rectangle[{AbsoluteTime[{1790}], 0}, {AbsoluteTime[{1830}], 300}], Purple, Rectangle[{AbsoluteTime[{1914}], 0}, {AbsoluteTime[{2000}], 300}]}]
Out[9]=

Individual sunspot cycles are best investigated using data that is monthly in resolution. The latest solar maximum peaked in April of 2014 and it was weaker than the previous solar maximum in 2001:

In[10]:=
monthlysunspotts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{1997}], DateObject[{2020}]}, "MonthlySunspotNumber"]
Out[10]=
In[11]:=
DateListPlot[monthlysunspotts, FrameLabel -> {None, Automatic}]
Out[11]=

Daily sunspot numbers, especially near solar minimum, are not very impressive and sometimes are 0:

In[12]:=
dailysunspotts1 = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2019, 1, 1}], DateObject[{2019, 4, 3}]}, "DailySunspotNumber"]
Out[12]=
In[13]:=
DateListPlot[dailysunspotts1, FrameLabel -> {None, Automatic}]
Out[13]=

During a solar maximum, the sunspot number can become much higher:

In[14]:=
dailysunspotts2 = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2001, 3, 15}], DateObject[{2001, 4, 15}]}, "DailySunspotNumber"]
Out[14]=
In[15]:=
DateListPlot[dailysunspotts2, FrameLabel -> {None, Automatic}]
Out[15]=

You can overlay the daily, monthly and yearly averaged data:

In[16]:=
dailysunspotts3 = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{1997}], DateObject[{2020}]}, "DailySunspotNumber"]
Out[16]=
In[17]:=
DateListPlot[{dailysunspotts3, monthlysunspotts, annualsunspotts}, FrameLabel -> {None, Automatic}, PlotRange -> {{{1997}, {2020}}, All}]
Out[17]=

Solar x-rays and solar flares

Solar flares are often the source of much of the interesting space weather effects observed on Earth. These are high-energy events, usually best observed in x‐rays. There are different bands of x‐rays that are available; the shorter wavelength band runs from .05 to .4 nm and the longer wavelength band runs from .1 to .8 nm (note: the bands overlap each other in wavelength range).

Find the current solar x-ray flux values:

In[18]:=
ResourceFunction[
 "SpaceWeatherData"][{"ShortSolarXRayFlux", "LongSolarXRayFlux"}]
Out[18]=

Plot the current day’s long solar x-ray flux over time:

In[19]:=
xraylongts = ResourceFunction["SpaceWeatherData"][Today, "LongSolarXRayFlux"]
Out[19]=
In[20]:=
DateListLogPlot[xraylongts, FrameLabel -> {None, Automatic}]
Out[20]=

Plot the current day’s long and short solar x-ray fluxes for comparison:

In[21]:=
xrayts = ResourceFunction["SpaceWeatherData"][
  Today, {"ShortSolarXRayFlux", "LongSolarXRayFlux"}]
Out[21]=
In[22]:=
DateListLogPlot[xrayts, FrameLabel -> {None, Automatic}]
Out[22]=

The largest solar flare recorded at the time of writing happened in early April 2001:

In[23]:=
xraymaxts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2001, 4, 1}], DateObject[{2001, 4, 5}]}, {"ShortSolarXRayFlux", "LongSolarXRayFlux"}]
Out[23]=
In[24]:=
DateListLogPlot[xraymaxts, FrameLabel -> {None, Automatic}]
Out[24]=

Solar wind

The solar wind is a stream of charged particles that come from the outer atmosphere of the Sun. The speed, temperature and density of this flow of particles change with time due to interactions with the Sun's magnetic field.

Get the current values of the solar wind speed, temperature and proton flux:

In[25]:=
ResourceFunction[
 "SpaceWeatherData"][{"SolarWindBulkSpeed", "SolarWindIonTemperature",
   "SolarWindProtonDensity"}]
Out[25]=

Plot the solar wind speed over a range of several days:

In[26]:=
windts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2019, 4, 1}], DateObject[{2019, 4, 9}]}, "SolarWindBulkSpeed"]
Out[26]=
In[27]:=
DateListPlot[windts, FrameLabel -> {None, Automatic}]
Out[27]=

Plot the solar wind temperature over a range of several days:

In[28]:=
tempts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2019, 4, 1}], DateObject[{2019, 4, 9}]}, "SolarWindIonTemperature"]
Out[28]=
In[29]:=
DateListPlot[tempts, FrameLabel -> {None, Automatic}]
Out[29]=

Plot the solar wind proton density over a range of several days:

In[30]:=
protonts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2019, 4, 1}], DateObject[{2019, 4, 9}]}, "SolarWindProtonDensity"]
Out[30]=
In[31]:=
DateListPlot[protonts, FrameLabel -> {None, Automatic}]
Out[31]=

Interplanetary magnetic field

The Interplanetary Magnetic Field (IMF) is the extension of the solar magnetic field measured away from the Sun, among the planets. The point where the IMF meets the Earth’s magnetic field is called the magnetopause. At the magnetopause, the z component of the Earth’s magnetic field points north. If the z component of the IMF points strongly south (i.e. negative), then this partially cancels out the Earth’s protective magnetic field and allows more solar plasma to come through and potentially interact with the Earth’s atmosphere, causing auroras.

The coordinate system used for measuring the Interplanetary Magnetic Field is called the geocentric solar ecliptic system (GSE), defined here. The GSE has its x axis pointing from the Earth toward the Sun and its y axis is chosen to be in the ecliptic plane pointing to the Earth’s west (thus opposing planetary motion). Its z axis is parallel to the ecliptic pole. Relative to an inertial system, this system rotates once per year as the Earth circles the Sun.

Find the current IMF magnitude and components:

In[32]:=
ResourceFunction[
 "SpaceWeatherData"][{"IMFBMagnitude", "IMFBx", "IMFBy", "IMFBz"}]
Out[32]=

Plot the z component of the IMF over a range of several days:

In[33]:=
bzts = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2017, 9, 20}], DateObject[{2017, 10, 1}]}, "IMFBz"]
Out[33]=
In[34]:=
DateListPlot[bzts, FrameLabel -> {None, Automatic}]
Out[34]=

Planetary K-index

The planetary K‐index, which measures the strength of a geomagnetic storm, is a coarse parameter measured every three hours or so. The higher the value, the more likely it is to see an aurora at lower latitudes. For the northern hemisphere, typically a value of 7 is the minimum needed to see an aurora as far south as Chicago.

Find the current planetary K-index value:

In[35]:=
ResourceFunction["SpaceWeatherData"]["PlanetaryKIndex"]
Out[35]=

Plot the planetary K-index over a range of several days:

In[36]:=
kindexts = TimeSeries[
  ResourceFunction[
   "SpaceWeatherData"][{DateObject[{2017, 9, 20}], DateObject[{2017, 10, 1}]}, "PlanetaryKIndex"], ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]
Out[36]=
In[37]:=
DateListPlot[kindexts, FrameLabel -> {None, Automatic}]
Out[37]=

Solar radio flux

Radio flux from the Sun measured at a wavelength of 10.7 cm can be used as a general indicator of solar activity. Radio waves at this wavelength are generated at the boundary between the chromosphere and corona of the Sun. The flux correlates well with a number of other solar activity indicators.

Find the current solar 10.7cm radio flux:

In[38]:=
ResourceFunction["SpaceWeatherData"]["TenDotSevenCMSolarRadioFlux"]
Out[38]=

Plot the planetary K-index over a range of four months:

In[39]:=
radiots = ResourceFunction[
  "SpaceWeatherData"][{DateObject[{2019, 1, 1}], DateObject[{2019, 4, 9}]}, "TenDotSevenCMSolarRadioFlux"]
Out[39]=
In[40]:=
DateListPlot[radiots, FrameLabel -> {None, Automatic}]
Out[40]=

Possible Issues

Some properties have a very high time resolution, so if a large date range is requested, the query may time out:

In[41]:=
ResourceFunction[
 "SpaceWeatherData"][{DateObject[{2001, 4, 1}], DateObject[{2019, 4, 10}]}, "ShortSolarXRayFlux"]
Out[41]=

To avoid this issue, keep the time range narrower:

In[42]:=
ResourceFunction[
 "SpaceWeatherData"][{DateObject[{2019, 4, 1}], DateObject[{2019, 4, 10}]}, "ShortSolarXRayFlux"]
Out[42]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information