# Wolfram Mathematica

## Create a Fireball Meteor EntityStore

The Wolfram Knowledgebase contains a vast wealth of information spanning many diverse areas. It also boasts a powerful suite of functionality for representing, accessing, and computing with this knowledge. Now it is also possible (and even straightforward) for users to create their own entity-property collections and work with them as if they were built-in data. Here, the process of creating and using an entity store for fireball meteors (known as bolides) based on an existing data source is illustrated.

Use Import to download a bolide dataset maintained by the Jet Propulsion Laboratory.

In:= ```(rawdata = Import["http://neo.jpl.nasa.gov/fireballs/", "FullData"])[[3, 9, 2, 12, 1, ;; 5]]```
Out= Define a utility function to attach units to the raw data.

In:= ```AddUnits[x_, u_: "Kilometers"/"Seconds"] := If[NumberQ[x], Quantity[Interpreter["Number"][x], u], Missing["NotAvailable"]]```

Extract relevant parts of the data, add appropriate Quantity tagging, and create the entity store.

show complete Wolfram Language input
In:= ```bolidedata = DeleteCases[{ DateObject[#1], With[{i = Interpreter["GeoCoordinates"][#2 <> " " <> #3]}, If[Head[i] === Missing, i, GeoPosition[Join[i[], If[NumberQ[#4], {#4 10^3}, {}]]]]], AddUnits[#5], AddUnits[#6], AddUnits[#7], AddUnits[#8], AddUnits[#9, "Joules"], AddUnits[#10, "MetricKilotons"] } & @@@ rawdata[[3, 9, 2, 12, 1, 2 ;;]], {_, _Missing, __}];```
In:= ```entities = Association @@ MapIndexed[ "Bolide" <> ToString[First[#2]] -> <| "Date" -> #[], "Position" -> #[], "Velocity" -> #[], "VelocityX" -> #[], "VelocityY" -> #[], "VelocityZ" -> #[], "TotalRadiatedEnergy" -> #[], "CalculatedTotalImpactEnergy" -> #[], "Label" -> "bolide on " <> DateString[#[]] <> " GMT" |> &, bolidedata];```
In:= ```properties = <| "Date" -> <|"Label" -> "date"|>, "Position" -> <|"Label" -> "position"|>, "Velocity" -> <|"Label" -> "velocity"|>, "VelocityX" -> <|"Label" -> "velocity x\[Hyphen]component"|>, "VelocityY" -> <|"Label" -> "velocity y\[Hyphen]component"|>, "VelocityZ" -> <|"Label" -> "velocity z\[Hyphen]component"|>, "TotalRadiatedEnergy" -> <|"Label" -> "total radiated energy"|>, "CalculatedTotalImpactEnergy" -> <|"Label" -> "calculated total impact energy"|> |>;```
In:= ```store = EntityStore["Bolide" -> <| "Label" -> "bolide", "LabelPlural" -> "bolides", "Entities" -> entities, "Properties" -> properties |>]```
Out= Register the store for this session.

In:= `PrependTo[\$EntityStores, store];`

Create an "EntityAssociation" of bolide positions and energies.

In:= ```ea = EntityValue["Bolide", {"Position", "TotalRadiatedEnergy"}, "EntityAssociation"];```

Make a geographic plot of bolide visibilities based on their heights and sky positions.

In:= `GeoGraphics[{GeoVisibleRegion[#] & @@@ Values[ea]}]`
Out= Extract bolide energies into a QuantityArray.

In:= `energies = QuantityArray[Values[ea][[All, -1]]]`
Out= Visualize bolide energies using a histogram.

In:= `Histogram[energies, "Log", AxesLabel -> {"energy (J)", "count"}]`
Out= Apply a scaling function to give a qualitative picture of fireball brightnesses.

show complete Wolfram Language input
In:= `scale[e_] := Quantity[1.*10^4 Sqrt[e/Max[energies]], "Kilometers"]`
In:= `GeoGraphics[{Red, GeoDisk[#1, scale[#2]] & @@@ Values[ea]}]`
Out= 