Wolfram 언어

풍부한 Knowledgebase 액세스

유성체의 EntityStore 작성

Wolfram Knowledgebase는 폭 넓은 분야를 커버하는 대량의 정보를 포함하고 있습니다. 또한 이 지식을 나타내거나 이에 접근하여 적합하고 강력한 계산을 수행할 수 있는 기능을 갖추고 있습니다. 사용자가 자신의 엔티티 특성 컬렉션을 생성하고 마치 임베디드 데이터처럼 그것을 사용하는 것 역시 가능하며 또한 간단히 수행할 수 있게 되었습니다. 다음에서 기존 데이터 원본을 기반으로 유성체 (폭발 유성)에 대한 엔티티 스토어의 작성과 사용 과정을 설명합니다.

Jet Propulsion Laboratory에서 관리되는 폭발 유성의 데이터 집합을 Import를 사용하여 다운로드합니다.

In[1]:=
Click for copyable input
(rawdata = Import["http://neo.jpl.nasa.gov/fireballs/", "FullData"])[[3, 9, 2, 12, 1, ;; 5]]
Out[1]=

원시 데이터에 단위로 쓰일 효용 함수를 정의합니다.

In[2]:=
Click for copyable input
AddUnits[x_, u_: "Kilometers"/"Seconds"] := If[NumberQ[x], Quantity[Interpreter["Number"][x], u], Missing["NotAvailable"]]

데이터의 관련된 부분을 추출하여 적절한 Quantity 태그를 붙이고 엔티티 스토어를 생성합니다.

전체 Wolfram 언어 입력 표시하기
In[3]:=
Click for copyable input
bolidedata = DeleteCases[{ DateObject[#1], With[{i = Interpreter["GeoCoordinates"][#2 <> " " <> #3]}, If[Head[i] === Missing, i, GeoPosition[Join[i[[1]], 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[4]:=
Click for copyable input
entities = Association @@ MapIndexed[ "Bolide" <> ToString[First[#2]] -> <| "Date" -> #[[1]], "Position" -> #[[2]], "Velocity" -> #[[3]], "VelocityX" -> #[[4]], "VelocityY" -> #[[5]], "VelocityZ" -> #[[6]], "TotalRadiatedEnergy" -> #[[7]], "CalculatedTotalImpactEnergy" -> #[[8]], "Label" -> "bolide on " <> DateString[#[[1]]] <> " GMT" |> &, bolidedata];
In[5]:=
Click for copyable input
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[6]:=
Click for copyable input
store = EntityStore["Bolide" -> <| "Label" -> "bolide", "LabelPlural" -> "bolides", "Entities" -> entities, "Properties" -> properties |>]
Out[6]=

이 세션에 스토어를 등록합니다.

In[7]:=
Click for copyable input
PrependTo[$EntityStores, store];

폭발 유성의 위치와 에너지에 대한 "EntityAssociation"을 생성합니다.

In[8]:=
Click for copyable input
ea = EntityValue["Bolide", {"Position", "TotalRadiatedEnergy"}, "EntityAssociation"];

폭발 유성의 가시성을 표현한 지리적 플롯을 그 높이와 천공의 위치에 따라 만듭니다.

In[9]:=
Click for copyable input
GeoGraphics[{GeoVisibleRegion[#] & @@@ Values[ea]}]
Out[9]=

폭발 유성의 에너지를 QuantityArray 중에 추출합니다.

In[10]:=
Click for copyable input
energies = QuantityArray[Values[ea][[All, -1]]]
Out[10]=

폭발 유성의 에너지를 히스토그램을 사용하여 시각화합니다.

In[11]:=
Click for copyable input
Histogram[energies, "Log", AxesLabel -> {"energy (J)", "count"}]
Out[11]=

스케일링 함수를 적용하여 화구 밝기의 질적 이미지를 구합니다.

전체 Wolfram 언어 입력 표시하기
In[12]:=
Click for copyable input
scale[e_] := Quantity[1.*10^4 Sqrt[e/Max[energies]], "Kilometers"]
In[13]:=
Click for copyable input
GeoGraphics[{Red, GeoDisk[#1, scale[#2]] & @@@ Values[ea]}]
Out[13]=

관련 예제

en es fr ja pt-br ru zh