Advertisement
Guest User

Untitled

a guest
Feb 13th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. # Packages to uniformly distribute lat/lon on a sphere and plot map
  2. require(geosphere)
  3. require(rworldmap)
  4.  
  5.  
  6. # Steffan-Boltzmann Law
  7. SBlaw <- function(I, alpha = 0.3, epsilon = 1, sigma = 5.670373e-8){
  8. (I*(1-alpha)/(epsilon*sigma))^.25
  9. }
  10.  
  11. # Calculate intensity of sunlight at each lat/lon ##
  12. # -The light is brightest at lat = 0, lon =0 (max 1367 W/m^2)
  13. # We need to convert lat/lon to radians for R's cos function
  14. # Irrad cannot be negative, so a lower bound is set at zero
  15. set.seed(1234)
  16. Imax = 1367
  17. Npts = 100
  18. LonLat = randomCoordinates(Npts)*pi/180
  19. Irrad = pmax(0, Imax*cos(LonLat[, "lon"])*cos(LonLat[, "lat"]))
  20. res = as.data.frame(cbind(LonLat, Irrad, Temp = SBlaw(Irrad)))
  21.  
  22. # Mean Temperature
  23. mean(SBlaw(Irrad))
  24.  
  25. # Equilibrium Temperature
  26. SBlaw(mean(Irrad))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement