R/deg2area.r

Defines functions deg2area_m2 deg2area_ha

Documented in deg2area_ha deg2area_m2

#' convert degree of latitue [deg] to area [Ha]
#' @param lat latitue
#' @param res resolution
#' @return area in Ha 
deg2area_ha<-function(lat,res=0.5){
    deg2rad <- function(deg){
        return (deg*pi*0.00555555555555)
    }
    area<-(111e3*res)*(111e3*res)*cos(deg2rad(lat))/10000#ha
    return(area)
}


#' convert degree of latitue [deg] to area [m^2]
#' @param lat latitue
#' @param res resolution
#' @return area in Ha 
deg2area_m2<-function(lat,res=0.5){
    deg2rad <- function(deg){
        return (deg*pi*0.00555555555555)
    }
    area<-(111e3*res)*(111e3*res)*cos(deg2rad(lat))
    return(area)
}
sinanshi/LPJmL_RUtil documentation built on Feb. 8, 2023, 5:56 p.m.