Wolfram Language

Acesso mais produtivo à base de conhecimento

Faça a previsão do tempo

A Wolfram Knowledgebase contém não só dados de conhecimento estático e em tempo real, mas também previsões de eventos futuros, tais como aqueles associados ao clima. Este exemplo extrai previsão usando WeatherForecastData, compara-os com os valores históricos conhecidos de AirTemperatureData, e fornece um número de visualizações dos resultados.

Saiba as temperaturas médias previstas para esta semana para a capital da Groenlândia, especificadas usando inputs de forma livre.

In[1]:=
Click for copyable input
forecast = WeatherForecastData[\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "greenland capital", Typeset`boxes$$ = RowBox[{ TemplateBox[{"\"Greenland\"", RowBox[{"Entity", "[", RowBox[{"\"Country\"", ",", "\"Greenland\""}], "]"}], "\"Entity[\\\"Country\\\", \\\"Greenland\\\"]\"", "\"country\""}, "Entity"], "[", TemplateBox[{"\"capital city\"", RowBox[{"EntityProperty", "[", RowBox[{"\"Country\"", ",", "\"CapitalCity\""}], "]"}], "\"EntityProperty[\\\"Country\\\", \\\"CapitalCity\\\"]\""}, "EntityProperty"], "]"}], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.449168`6.10395380181902, "Messages" -> {}}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic, Dynamic[Typeset`query$$], Dynamic[Typeset`boxes$$], Dynamic[Typeset`allassumptions$$], Dynamic[Typeset`assumptions$$], Dynamic[Typeset`open$$], Dynamic[Typeset`querystate$$]], StandardForm], ImageSizeCache->{121., {7., 16.}}, TrackedSymbols:>{ Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$, Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}], DynamicModuleValues:>{}, UndoTrackedVariables:>{Typeset`open$$}], BaseStyle->{"Deploy"}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\), "Temperature"]
Out[1]=

Extraia as temperaturas médias semanais durante a última década e compare com as temperaturas dos 10 anos anteriores.

mostre o input completo da Wolfram Language
In[2]:=
Click for copyable input
history = Table[TimeSeriesShift[ AirTemperatureData[ Entity["Country", "Greenland"][ EntityProperty["Country", "CapitalCity"]], With[{past = Today - y}, {past, past + Quantity[1, "Weeks"], All}]], y], {y, Quantity[Range[10], "Years"]}]
In[3]:=
Click for copyable input
Show[DateListPlot[forecast /. Interval[x_] :> Mean[x], PlotStyle -> Red], DateListPlot[history, PlotStyle -> Opacity[0.5], PlotRange -> Full, PlotLegends -> {Table[ DatePlus[DateObject[Today], -Quantity[x, "Years"]]["Year"], {x, 10}]}]]
Out[3]=

Examine e contraste a diferença de variações de temperatura entre as regiões em volta de duas cidades diferentes.

In[4]:=
Click for copyable input
Table[WeatherForecastData[ GeoDisk[city[EntityProperty["City", "Position"]], Quantity[100, "Miles"]], "Temperature", DateObject[ Tomorrow, {12}]], {city, {Entity[ "City", {"Champaign", "Illinois", "UnitedStates"}], Entity["City", {"SanFrancisco", "California", "UnitedStates"}]}}]
Out[4]=

Liste as seis maiores cidades da Alemanha e obtenha a previsão das altas temperaturas para essas cidades.

In[5]:=
Click for copyable input
cities = EntityClass[ "City", {"Country" -> "Germany", "Population" -> TakeLargest[6]}] // EntityList
Out[5]=
In[6]:=
Click for copyable input
data = {CityData[#, "Coordinates"], CityData[#, "Name"], WeatherForecastData[#, "MaxTemperature"]["FirstValue"]} & /@ cities;

Visualize em um mapa.

mostre o input completo da Wolfram Language
In[7]:=
Click for copyable input
GeoGraphics[{ GeoStyling["ReliefMap"], EdgeForm[Thin], Opacity[0.5], Polygon[Entity["Country", "Germany"]], PointSize[Large], Opacity[1], {Black, Text[#2, GeoPosition[#1], {-1.5, 0}], Red, Point[GeoPosition[#1]], Inset[IconData["AirTemperature", #3], GeoPosition[#1], Bottom, 1]} & @@@ data}]
Out[7]=

Exemplos Relacionados

de en es fr ja ko ru zh