# Trace la trayectoria anual del Sol

Encuentre la trayectoria diaria del Sol en los solsticios de verano y de invierno y el equinoccio de primavera, y los puntos del analema completo.

 In[1]:= Xsummerpath = SunPosition[ DateRange[DateObject[{2014, 6, 21, 5, 0}], DateObject[{2014, 6, 21, 20, 0}], {10, "Minute"}]]; winterpath = SunPosition[ DateRange[DateObject[{2014, 12, 21, 5, 0}], DateObject[{2014, 12, 21, 20, 0}], {10, "Minute"}]]; equinoxpath = SunPosition[ DateRange[DateObject[{2014, 3, 20, 5, 0}], DateObject[{2014, 3, 20, 20, 0}], {10, "Minute"}]]; analemmaPoints = Map[QuantityMagnitude, SunPosition[ DateRange[DateObject[{2014, 1, 1, 9, 0}], DateObject[{2014, 12, 31, 9, 0}], 10]]["Values"], {2}];

Defina algunos colores para estilo.

 In[2]:= XskyTopColor = RGBColor[0.27, 0.2, 0.75]; skyBottomColor = RGBColor[ 0.25, 0.43, 0.82]; groundColor = RGBColor[0.1, 0.1, 0.1]; sunColor = RGBColor[ 0.8588235294117647, 0.788235294117647, 0.5411764705882353];

Seleccione algunas posiciones específicas del Sol en ciertas fechas de interés.

 In[3]:= XdisksOfSpecialInterest = Disk[QuantityMagnitude /@ #, 1] & /@ { summerpath[DateObject[{2014, 6, 21, 9, 0}]], winterpath[DateObject[{2014, 12, 21, 9, 0}]], equinoxpath[DateObject[{2014, 3, 20, 9, 0}]], SunPosition[DateObject[{2014, 9, 22, 9, 0}]]};

Cree líneas que muestran la trayectoria diaria del Sol en los solsticios y equinoccio.

 In[4]:= XlinesOfSpecialInterest = Line[Map[QuantityMagnitude, #, {2}]] & /@ {summerpath["Values"], winterpath["Values"], equinoxpath["Values"]};

Cree anotaciones para etiquetar varios atributos.

 In[5]:= Xlabels = {sunColor, Rotate[Text["summer solstice", {86, 42}], 45 Degree], Rotate[Text[DateString[{2014, 6, 21}, {"DayShort", " ", "MonthNameShort", " ", "Year"}], {88, 40}], 45 Degree], Rotate[Text["equinox", {120, 28}], 40 Degree], Rotate[Text["winter solstice", {130, 5}], 45 Degree], Rotate[Text[DateString[{2014, 12, 21}, {"DayShort", " ", "MonthNameShort", " ", "Year"}], {133, 4}], 45 Degree], Rotate[Text[DateString[{2014, 9, 22, 9, 0}, {"DayShort", " ", "MonthNameShort", " ", "Year"}], {116.5, 30.5}], 41 Degree], Rotate[Text[DateString[{2014, 3, 20, 9, 0}, {"DayShort", " ", "MonthNameShort", " ", "Year"}], {104, 19}], 46 Degree]};

Cree una imagen que muestre la trayectoria anual del Sol en su ubicación.

 In[6]:= XSunPlot[] := Block[{xMin, xMax, yMin, yMax}, {{xMin, xMax}, {yMin, yMax}} = ({Min[#], Max[#]} + 10 {-1, 1}) & /@ Transpose[analemmaPoints]; Graphics[{Blue, Polygon[ {{xMin, yMin}, {xMin, yMax}, {xMax, yMax}, {xMax, yMin}}, VertexColors -> {skyBottomColor, skyTopColor, skyTopColor, skyBottomColor}], {sunColor, Disk[#, .5] & /@ analemmaPoints, EdgeForm[Red], disksOfSpecialInterest}, {sunColor, Opacity[.5], linesOfSpecialInterest}, {groundColor, Rectangle[{xMin, yMin}, {xMax, 0}]}, labels}, Frame -> True, FrameLabel -> {"azimuth", "altitude"}, PlotRange -> {{xMin, xMax}, {yMin, yMax}}, PlotRangeClipping -> True, PlotLabel -> "Yearly path of the Sun at 9:00 in " <> CommonName[First[GeoIdentify["City", \$GeoLocation]]]] ]
 In[7]:= XSunPlot[]
 Out[7]=

## Mathematica

Questions? Comments? Contact a Wolfram expert »