Wolfram Language

Processamento de séries temporais

Visualize padrões sazonais

Compare precipitação sazonal na região centro oeste e uma sudoeste.

WeatherData fornece precipitação acumulada em cm.

In[1]:=
Click for copyable input
start = {1999, 1, 1}; end = {2015, 12, 31};
In[2]:=
Click for copyable input
getData[place_] := WeatherData[place, "TotalPrecipitation", {start, end, "Month"}]

Crie uma TimeSeries de precipitação para Champaign, IL, e Phoenix, AZ. Especifique MissingDataMethod para usar interpolação para completar os dados faltantes.

In[3]:=
Click for copyable input
makeTS[place_] := TimeSeries[getData[place], MissingDataMethod -> "Interpolation"]
In[4]:=
Click for copyable input
tsIL = makeTS[ Entity["City", {"Champaign", "Illinois", "UnitedStates"}]]
Out[4]=
In[5]:=
Click for copyable input
tsAZ = makeTS[Entity["City", {"Phoenix", "Arizona", "UnitedStates"}]]
Out[5]=

Crie WeightedData com quantidades de precipitação como ponderações e faça um gráfico DateHistogram calculando a média dos dados sobre o número total de anos.

In[6]:=
Click for copyable input
dataIL = WeightedData[tsIL["Dates"], tsIL["Values"]]; dataAZ = WeightedData[tsAZ["Dates"], tsAZ["Values"]];
In[7]:=
Click for copyable input
totalyears = (end[[1]] - start[[1]] + 1);
In[8]:=
Click for copyable input
avg := Function[{x, y}, y/totalyears]
In[9]:=
Click for copyable input
makeHistogram[data_, lab_] := DateHistogram[data, "Month", avg, DateReduction -> "Year", PlotRange -> {All, {-1, 9}}, AxesLabel -> "cm", PlotLabel -> lab]
In[10]:=
Click for copyable input
{makeHistogram[dataIL, "IL"], makeHistogram[dataAZ, "AZ"]}
Out[10]=

Exemplos Relacionados

de en es fr ja ko ru zh