11/18/2020

Overview

Sun Ephemeris Calculator is a Shiny app that calculated the position of the Sun throughout the day for a specific date, geographical position (provided as latitude and longitude) and time zone.

The application calculates the position of the Sun (azimuth and elevation) for each minute interval of the day and then displays in a table the time and position for sunrise, solar noon and sunset. It also provides a map showing the location corresponding to the latitude and longitude values and plots showing how the azimuth of the Sun evolves with the elevation of the Sun, and how these two magnitudes evolved wih time throughout the day.

Input

There are four input fields: date, time zone, latitude and longitude.

  • Date: A date can be entered either writing or selecting from a calendar that appears when clicking on the field.

  • Time zone: The time zone can be either entered by writing or by selecting from a list. There are several names accepted for many time zones.

  • Latitude: Latitude can be entered as a number.

  • Longitude: Longitude can be entered as a number.

  • Map: At the end a leaflet map shows the position corresponding to the selected latitude and longitude. This map is interactive, but does not serve to define a new position.

Summary Table

The first output is a summary table displaying the values for local time, and azimuth and elevation angles of the Sun at sunrise, solar noon and sunset. The table is constructed as follows.

data.frame(Local_Time=c(timechar[indsunrise],
                        timechar[indnoon],timechar[indsunset]),
           AZ=c(az[indsunrise],az[indnoon],az[indsunset]),
           EL=c(el[indsunrise],el[indnoon],el[indsunset]),
           row.names=c("Sunrise","Solar Noon","Sunset"))
           Local_Time       AZ          EL
Sunrise         07:07 117.8636 -0.06628713
Solar Noon      11:45 179.9368 25.60712401
Sunset          16:23 241.9910 -0.05843520

Note that Shiny formats the table with horizontal lines and rounds the values of the angles to 2 decimal position.

Plots

The second output is a collection of three plots displaying the change in elevation with respect to azimuth and the evolution in elevation and azimuth as time passes in the selected day and location.

plot(data$az,data$el,xlab="Azimuth",ylab="Elevation",type="l")
axis(3,at=seq(0,315,45),labels=c("N","NE","E","SE","S","SW","W","NW"))
plot(data$timetz,data$el,xlab="Local time",ylab="Elevation",type="l")
plot(data$timetz,data$az,xlab="Local time",ylab="Azimuth",type="l")