# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Get 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"][ gives a property association of the most recent values of all available properties. | |

ResourceFunction["SpaceWeatherData"][ gives either a value or values of the specifed property on the specified | |

ResourceFunction["SpaceWeatherData"][{ gives the value or values of the property between |

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.

Use of ResourceFunction["SpaceWeatherData"] requires an internet network connection.

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 |

ResourceFunction["SpaceWeatherData"][] is equivalent to ResourceFunction["SpaceWeatherData"]["PropertyAssociation"].

List all available properties:

In[1]:= |

Out[1]= |

Get an Association of the most recent values:

In[2]:= |

Out[2]= |

Get a dataset of the most recent values:

In[3]:= |

Out[3]= |

Obtain the most recent daily sunspot number:

In[4]:= |

Out[4]= |

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

In[5]:= |

Out[5]= |

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, 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[6]:= |

Out[6]= |

Find the current monthly averaged sunspot number:

In[7]:= |

Out[7]= |

Find the current yearly averaged sunspot number:

In[8]:= |

Out[8]= |

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[9]:= |

Out[9]= |

In[10]:= |

Out[10]= |

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[11]:= |

Out[11]= |

In[12]:= |

Out[12]= |

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

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

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

In[15]:= |

Out[15]= |

In[16]:= |

Out[16]= |

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

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

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[19]:= |

Out[19]= |

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

In[20]:= |

Out[20]= |

In[21]:= |

Out[21]= |

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

In[22]:= |

Out[22]= |

In[23]:= |

Out[23]= |

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

In[24]:= |

Out[24]= |

In[25]:= |

Out[25]= |

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[26]:= |

Out[26]= |

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

In[27]:= |

Out[27]= |

In[28]:= |

Out[28]= |

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

In[29]:= |

Out[29]= |

In[30]:= |

Out[30]= |

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

In[31]:= |

Out[31]= |

In[32]:= |

Out[32]= |

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[33]:= |

Out[33]= |

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

In[34]:= |

Out[34]= |

In[35]:= |

Out[35]= |

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[36]:= |

Out[36]= |

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

In[37]:= |

Out[37]= |

In[38]:= |

Out[38]= |

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[39]:= |

Out[39]= |

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

In[40]:= |

Out[40]= |

In[41]:= |

Out[41]= |

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

In[42]:= |

Out[42]= |

To avoid this issue, keep the time range narrower:

In[43]:= |

Out[43]= |

- 3.1.0 – 26 July 2023
- 3.0.0 – 30 September 2020
- 2.0.0 – 18 October 2019
- 1.0.0 – 10 May 2019

This work is licensed under a Creative Commons Attribution 4.0 International License