RenderableTimeVaryingFitsSphere

Inherits Renderable

Reads a data sequence from specifically FITS files, makes textures from them, and wraps them onto a sphere. A sequence is a data source consisting of multiple data files that each correspond to a specific time.

LoadingType can be specified in two ways;

  1. StaticLoading: In this case, all data will be loaded on startup, from the location specified in the TextureSource parameter. Other required parameters are LayerNames and LayerMinMaxCapValues that require at least one entry each. LayerNames assigns a name to an index that corresponds to a layer in the FITS data to use. For each entry in LayerNames, there should also be a matching entry in the LayerMinMaxCapValues that specifies the min and max range for the data.

  2. DynamicDownloading: This case downloads the data during runtime. In addition to LayerNames and LayerMinMaxCapValues, a few more parameters are required in this case: InfoURL together with DataID will construct a URL that is used for a HTTP request that returns meta data. DataURL and DataID, together with this meta data, will be used in constructing another HTTP request that returns the list with data files. The DataID specify which data source to use.

In addition, but not required, the FitsLayer parameter can be specified to use a specific data layer for the sphere texture. The index should match one of the layers in LayerNames and LayerMinMaxCapValues. CacheData and showAtAllTimes are two other optional parameters.

Members

Name

Documentation

Type

Description

Optional

BlendingOption

Controls the blending function used to calculate the colors of the sphere with respect to the opacity.

String

In list { Default, Additive, Polygon, Color Adding }

Yes

CacheData

This is set to false by default and will delete all the downloaded content when OpenSpace is shut down, if using dynamic downloading. Set to true to save all the downloaded files.

Boolean

Value of type ‘Boolean’

Yes

ColorMap

Color map / Transfer function to use if UseColorMap is enabled.

File

Value of type ‘File’

Yes

DataID

A data ID that corresponds to what dataset to use if using dynamic downloading.

Integer

Value of type ‘Integer’

Yes

DataURL

A URL that returns a JSON formated page with a list of each available file.

String

Value of type ‘String’

Yes

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

DisableDepth

If disabled, no depth values are taken into account for this sphere, meaning that depth values are neither written or tested against during the rendering. This can be useful for spheres that represent a background image.

Boolean

Value of type ‘Boolean’

Yes

DisableFadeInOut

Enables/Disables the fade in and out effects.

Boolean

Value of type ‘Boolean’

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

FadeInThreshold

The distance from the center of the Milky Way at which the sphere should start to fade in, given as a percentage of the size of the object. A value of zero means that no fading in will happen.

Double

In range: ( 0, 1)

Yes

FadeOutThreshold

A threshold for when the sphere should start fading out, given as a percentage of how much of the sphere that is visible before the fading should start. A value of zero means that no fading out will happen.

Double

In range: ( 0, 1)

Yes

FitsLayer

The index, a whole positive number, of the layer in the FITS file to use as texture. If not specified, the first layer in the data will be used regardless. When specified, that data layer will be the option used.

Integer

Value of type ‘Integer’

Yes

InfoURL

A URL that returns a JSON formated page with metadata needed for the dataURL.

String

Value of type ‘String’

Yes

LayerMinMaxCapValues

A range per layer to be used to cap where the color range will lie. Values outside of range will be overexposed, i.e. data values below the min or above the max, will all be set to the min and max color value in range.

Table

Yes

LayerNames

This value specifies which name of the fits layer to use as texture.

Table

Yes

LoadingType

Download and load files on startup. Download and load files during run time. Choose type of loading.

String

In list { StaticLoading, DynamicDownloading }

Yes

MirrorTexture

If true, mirror the texture along the x-axis.

Boolean

Value of type ‘Boolean’

Yes

NumberOfFilesToQueue

This is a max value of the amount of files to queue up so that not to big of a data set is downloaded.

Integer

Value of type ‘Integer’

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent.

Double

In range: ( 0, 1)

Yes

Orientation

Specifies whether the texture is applied to the inside of the sphere, the outside of the sphere, or both.

String

In list { Outside, Inside, Both }

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker }

Yes

Segments

The number of segments that the sphere is split into.

Integer

Greater or equal to: 4

Yes

ShowAtAllTimes

Set if first/last file should render when time is outside of the sequence interval. This can be used regardless of LoadingType. If this value is not specified, the field lines are shown at all times.

Boolean

Value of type ‘Boolean’

Yes

Size

The radius of the sphere in meters.

Double

Greater than: 0

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties.

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

TextureProjection

Specifies the projection mapping to use for any texture loaded onto the sphere (assumes Equirectangular per default). Note that for “Angular Fisheye” only half the sphere will be textured - the hemisphere centered around the z-axis.

String

In list { Equirectangular, Angular Fisheye }

Yes

TextureSource

A directory on disk from which to load the texture files for the sphere.

File

Value of type ‘File’

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

UseColorMap

Used to toggle color map on or off for the sphere. Mainly used to transform grayscale textures from data into color images.

Boolean

Value of type ‘Boolean’

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent.

Double

In range: ( 0, 1)

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker }

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties.

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

Asset Examples

  1local transforms = asset.require("scene/solarsystem/heliosphere/transforms_heliosphere")
  2
  3
  4local transferFunctions = asset.resource({
  5  Type = "HttpSynchronization",
  6  Name = "Today's Sun Transfer Functions",
  7  Identifier = "todayssun_transferfunctions",
  8  Version = 1
  9})
 10
 11
 12local blueBlackRed = transferFunctions .. "blue-black-red.txt"
 13
 14local infoURL = "https://iswa.ccmc.gsfc.nasa.gov/api/info?dataID="
 15local dataURL = "https://iswa.ccmc.gsfc.nasa.gov/api/between?dataID="
 16
 17local sunRadius = 695700000
 18-- This small 0.2% increase is an arbitrary number but necessary to make sure it is not
 19-- within the Sun sphere
 20local extendedRadius = sunRadius * 1.002
 21local fiveSunRadius = sunRadius * 5
 22local outerBoundary = sunRadius * 21.5
 23-- Slightly bigger radii to prevent z fighting rendering artifact compared to GONG-Z
 24local extendedRadiusAdapt = extendedRadius * 1.00002
 25local fiveSunRadiusAdapt = fiveSunRadius * 1.00002
 26local outerBoundaryAdapt = outerBoundary * 1.00002
 27
 28local WSA_62_Magnetic_Field_GONGZ_5_Rs = {
 29  Identifier = "WSA_62_Magnetic_Field_GONGZ_5_Rs",
 30  Parent = transforms.WSAOffset60.Identifier,
 31  TimeFrame = {
 32    Type = "TimeFrameInterval",
 33    Start = "2025 SEP 10 16:14:00"
 34  },
 35  Renderable = {
 36    Type = "RenderableTimeVaryingFitsSphere",
 37    Size = fiveSunRadius,
 38    Orientation = "Both",
 39    LoadingType = "DynamicDownloading",
 40    InfoURL = infoURL,
 41    DataURL = dataURL,
 42    DataID = 2841,
 43    FitsLayer = 0,
 44    LayerNames = {
 45      ['0'] = "Coronal Magnetic Field at 5 Solar Radii (nT)"
 46    },
 47    LayerMinMaxCapValues = {
 48      ['0'] = { -5000.0, 5000.0 }
 49    },
 50    ColorMap = blueBlackRed,
 51    UseColorMap = false,
 52    ShowPastFirstAndLastFile = false,
 53    Segments = 132
 54  },
 55  GUI = {
 56    Name = "Magnetic Field at 5Rs (GONG-Z)",
 57    Path = "/Solar System/Heliosphere/WSA Coronal Model",
 58    Description = [[Texture sequence of simulation model WSA 6.2, showing the coronal
 59      magnetic field on a sphere at 5 solar radii. Output: FITS files using GONG-Z Maps
 60      (RADOUT = 5.0).]],
 61    Focusable = false
 62  }
 63}
 64
 65local WSA_62_Magnetic_Field_ADAPT_5_Rs = {
 66  Identifier = "WSA_62_Magnetic_Field_ADAPT_5_Rs",
 67  Parent = transforms.HeliocentricEarthEquatorial180.Identifier,
 68  TimeFrame = {
 69    Type = "TimeFrameInterval",
 70    Start = "2025 SEP 10 16:14:00"
 71  },
 72  Renderable = {
 73    Type = "RenderableTimeVaryingFitsSphere",
 74    Size = fiveSunRadiusAdapt,
 75    Orientation = "Both",
 76    LoadingType = "DynamicDownloading",
 77    InfoURL = infoURL,
 78    DataURL = dataURL,
 79    DataID = 2842,
 80    FitsLayer = 0,
 81    LayerNames = {
 82      ['0'] = "Coronal Magnetic Field at 5 Solar Radii (nT)"
 83    },
 84    LayerMinMaxCapValues = {
 85      ['0'] = { -5000.0, 5000.0 }
 86    },
 87    ColorMap = blueBlackRed,
 88    UseColorMap = false,
 89    ShowPastFirstAndLastFile = false,
 90    Segments = 132
 91  },
 92  GUI = {
 93    Name = "Magnetic Field at 5Rs (GONG ADAPT)",
 94    Path = "/Solar System/Heliosphere/WSA Coronal Model",
 95    Description = [[Texture sequence of simulation model WSA 6.2, showing the coronal
 96      magnetic field on a sphere at 5 solar radii. Output: FITS file using
 97      ADAPT GONG realization 000 to 011 Maps (RADOUT = 5.0).]],
 98    Focusable = false
 99  }
100}
101
102local WSA_62_Magnetograms_GONGZ = {
103  Identifier = "WSA_62_Magnetograms_GONGZ",
104  Parent = transforms.WSAOffset60.Identifier,
105  TimeFrame = {
106    Type = "TimeFrameInterval",
107    Start = "2025 SEP 10 16:14:00"
108  },
109  Renderable = {
110    Type = "RenderableTimeVaryingFitsSphere",
111    Size = extendedRadius,
112    LoadingType = "DynamicDownloading",
113    InfoURL = infoURL,
114    DataURL = dataURL,
115    DataID = 2841,
116    FitsLayer = 4,
117    LayerNames = {
118      ['1'] = "Flux tube expansion factor evaluated at the source surface",
119      ['4'] = "Observed Photospheric Field (Gauss)",
120      ['5'] = "Distance from open field footpoint to nearest coronal boundary (deg)",
121      ['6'] = [[Open (1,2,3) and closed (0) regions on the photosphere [1=in-to-out
122        tracing; 2=out-to-in tracing; 3=both] (no units)]],
123      ['7'] = "Distance to current sheet at outer boundary (degrees)"
124    },
125    LayerMinMaxCapValues = {
126      ['1'] = { 0.0, 50.0 },
127      ['4'] = { -50.0, 50.0 },
128      ['5'] = { 0.0, 30.0 },
129      ['6'] = { 0.0, 4.0 },
130      ['7'] = { 0.0, 90.0 }
131    },
132    ColorMap = blueBlackRed,
133    UseColorMap = false,
134    ShowPastFirstAndLastFile = false,
135    Segments = 132
136  },
137  GUI = {
138    Name = "Solar Surface (GONG-Z)",
139    Path = "/Solar System/Heliosphere/WSA Coronal Model",
140    Description = [[Texture sequence of simulation model WSA 6.2, showing data on the
141      solar surface with multiple options in the list under Texture Layer Options. Output:
142      FITS files using GONG-Z Maps (RADOUT = 5.0).]],
143    Focusable = false
144  }
145}
146
147local WSA_62_Magnetograms_ADAPT = {
148  Identifier = "WSA_62_Magnetograms_ADAPT",
149  Parent = transforms.HeliocentricEarthEquatorial180.Identifier,
150  TimeFrame = {
151    Type = "TimeFrameInterval",
152    Start = "2025 SEP 10 16:14:00"
153  },
154  Renderable = {
155    Type = "RenderableTimeVaryingFitsSphere",
156    Size = extendedRadiusAdapt,
157    LoadingType = "DynamicDownloading",
158    InfoURL = infoURL,
159    DataURL = dataURL,
160    DataID = 2842,
161    FitsLayer = 4,
162    LayerNames = {
163      ['1'] = "Flux tube expansion factor evaluated at the source surface",
164      ['4'] = "Observed Photospheric Field (Gauss)",
165      ['5'] = "Distance from open field footpoint to nearest coronal boundary (deg)",
166      ['6'] = [[Open (1,2,3) and closed (0) regions on the photosphere [1=in-to-out
167        tracing; 2=out-to-in tracing; 3=both] (no units)]],
168      ['7'] = "Distance to current sheet at outer boundary (degrees)"
169    },
170    LayerMinMaxCapValues = {
171      ['1'] = { 0.0, 50.0 },
172      ['4'] = { -50.0, 50.0 },
173      ['5'] = { 0.0, 30.0 },
174      ['6'] = { 0.0, 4.0 },
175      ['7'] = { 0.0, 90.0 }
176    },
177    ColorMap = blueBlackRed,
178    UseColorMap = false,
179    ShowPastFirstAndLastFile = false,
180    Segments = 132
181  },
182  GUI = {
183    Name = "Solar Surface (GONG ADAPT)",
184    Path = "/Solar System/Heliosphere/WSA Coronal Model",
185    Description = [[Texture sequence of simulation model WSA 6.2, showing data on the
186      solar surface with multiple options in the list under Texture Layer Options. Output:
187      FITS file using ADAPT GONG realization 000 to 011 Maps (RADOUT = 5.0).]],
188    Focusable = false
189  }
190}
191
192local WSA_62_Velocity_Adapt_Outer_Boundary = {
193  Identifier = "WSA_62_velocity_ADAPT_Outer_Boundary",
194  Parent = transforms.HeliocentricEarthEquatorial180.Identifier,
195  TimeFrame = {
196    Type = "TimeFrameInterval",
197    Start = "2025 SEP 10 16:14:00"
198  },
199  Renderable = {
200    Type = "RenderableTimeVaryingFitsSphere",
201    Size = outerBoundaryAdapt,
202    LoadingType = "DynamicDownloading",
203    Orientation = "Both",
204    InfoURL = infoURL,
205    DataURL = dataURL,
206    DataID = 2911,
207    FitsLayer = 1,
208    LayerNames = {
209      ['0'] = "Coronal Magnetic Field at 21.5 Solar Radii (nT)",
210      ['1'] = "Solar Wind Speed at 21.5 Solar Radii (km/s)"
211    },
212    LayerMinMaxCapValues = {
213      ['0'] = { -200.0, 200.0 },
214      ['1'] = { 200.0, 850.0 }
215    },
216    ColorMap = blueBlackRed,
217    ShowPastFirstAndLastFile = false,
218    Segments = 132
219  },
220  GUI = {
221    Name = "Velocity at Outer Boundary (GONG-ADAPT)",
222    Path = "/Solar System/Heliosphere/WSA Coronal Model",
223    Description = [[Texture sequence of simulation model WSA 6.2, showing data on a sphere
224      at the outer boundary of the simulation model, either solar wind speed or coronal
225      magnetic field. Output: FITS file using ADAPT GONG realization 000-011 Maps
226      (RADOUT = 21.5).]],
227    Focusable = false
228  }
229}
230
231local WSA_62_Velocity_Gongz_Outer_Boundary = {
232  Identifier = "WSA_62_velocity_GONGZ_Outer_Boundary",
233  TimeFrame = {
234    Type = "TimeFrameInterval",
235    Start = "2025 SEP 10 16:14:00"
236  },
237  Parent = transforms.WSAOffset60.Identifier,
238  Renderable = {
239    Type = "RenderableTimeVaryingFitsSphere",
240    Size = outerBoundary,
241    Orientation = "Both",
242    LoadingType = "DynamicDownloading",
243    InfoURL = infoURL,
244    DataURL = dataURL,
245    DataID = 2910,
246    FitsLayer = 1,
247    LayerNames = {
248      ['0'] = "Coronal Magnetic Field at 21.5 Solar Radii (nT)",
249      ['1'] = "Solar Wind Speed at 21.5 Solar Radii (km/s)"
250    },
251    LayerMinMaxCapValues = {
252      ['0'] = { -200.0, 200.0 },
253      ['1'] = { 200.0, 850.0 }
254    },
255    ColorMap = blueBlackRed,
256    ShowPastFirstAndLastFile = false,
257    Segments = 132
258  },
259  GUI = {
260    Name = "Velocity at Outer Boundary (GONG-Z)",
261    Path = "/Solar System/Heliosphere/WSA Coronal Model",
262    Description = [[Texture sequence of simulation model WSA 6.2, showing data on a sphere
263      at the outer boundary of the simulation model, either solar wind speed or coronal
264      magnetic field. Output: FITS file using GONG-Z Maps (RADOUT = 21.5).]],
265    Focusable = false
266  }
267}
268
269
270asset.onInitialize(function()
271  openspace.addSceneGraphNode(WSA_62_Magnetic_Field_GONGZ_5_Rs)
272  openspace.addSceneGraphNode(WSA_62_Magnetic_Field_ADAPT_5_Rs)
273  openspace.addSceneGraphNode(WSA_62_Magnetograms_GONGZ)
274  openspace.addSceneGraphNode(WSA_62_Magnetograms_ADAPT)
275  openspace.addSceneGraphNode(WSA_62_Velocity_Adapt_Outer_Boundary)
276  openspace.addSceneGraphNode(WSA_62_Velocity_Gongz_Outer_Boundary)
277end)
278
279asset.onDeinitialize(function()
280  openspace.removeSceneGraphNode(WSA_62_Velocity_Gongz_Outer_Boundary)
281  openspace.removeSceneGraphNode(WSA_62_Velocity_Adapt_Outer_Boundary)
282  openspace.removeSceneGraphNode(WSA_62_Magnetograms_ADAPT)
283  openspace.removeSceneGraphNode(WSA_62_Magnetograms_GONGZ)
284  openspace.removeSceneGraphNode(WSA_62_Magnetic_Field_ADAPT_5_Rs)
285  openspace.removeSceneGraphNode(WSA_62_Magnetic_Field_GONGZ_5_Rs)
286end)
287
288asset.export(WSA_62_Magnetic_Field_GONGZ_5_Rs)
289asset.export(WSA_62_Magnetic_Field_ADAPT_5_Rs)
290asset.export(WSA_62_Magnetograms_GONGZ)
291asset.export(WSA_62_Magnetograms_ADAPT)
292asset.export(WSA_62_Velocity_Adapt_Outer_Boundary)
293asset.export(WSA_62_Velocity_Gongz_Outer_Boundary)
294
295
296
297asset.meta = {
298  Name = "Streaming Surface Data Dynamically",
299  Version = "1.0",
300  Description = [[Downloading data from the WSA 6.2 simulation model, showing the dynamic
301    Sun at any point. It includes .fits files for solar surface data. GONG-Z is the
302    zero-corrected synoptic surface magnetic maps from the Global Oscillation Network
303    Group, while GONG-ADAPT is a model based on GONG, where ADAPT stands for Air Force
304    Data Assimilative Photospheric Flux Transport.]],
305  Author = "CCMC",
306  URL = "https://openspaceproject.com",
307  License = "MIT license"
308}