Learn R Programming

StreamMetabolism (version 1.1.2)

sunrise.set: Calculate Sunrise Sunset Times

Description

This function calculates sunrise sunset times in POSIXct and returns it in a handy dandy format to either export as a csv file or use directly in the calculation of Stream Metabolism. This function is based on maptools which is based on the NOAA sunrise sunset claculator.

Usage

sunrise.set(lat, long, date, timezone = "UTC", num.days = 1)

Arguments

lat
Latitude in decimal degrees
long
Longitude in decimal degrees
date
starting date (needs to be in quotes and in the format yyyy/mm/dd)
timezone
Time zone set to UTC default (needs to be in quotes)
num.days
1 if you just want only the calculation preformed on "date" (default)

Value

Details

Remember that the Prime Meridian is 0 through Greenwich, England. So anything W is - and anything E is +. Also anything in the Northern hemisphere is + latitude and Southern Hemisphere is - lattitude. Generally UTC+5 is Eastern Standard Time, UTC+6 is CST, UTC+7 MST, UTC+8 PST. Another way of specifying time zones is Country City see examples. Be aware of timezones and daylight and standard time when using this function!!!!!!! This will help you avoid headaches caused because minor oversites = large error in your calculations

References

old site: http://www.esrl.noaa.gov/gmd/grad/solcalc/sunrise.html

new site: http://www.esrl.noaa.gov/gmd/grad/solcalc/

Examples

Run this code
#This is for Atlanta Georgia 
#(Only so that you can compare it to the NOAA 
#website that is given above)
sunrise.set(33.43, -84.22, "2008/01/01", timezone="UTC+5") 	

#Same As above but look at Time Zone Specification
sunrise.set(33.43, -84.22, "2008/01/01", timezone="America/New_York")

Run the code above in your browser using DataLab