GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
area_ellipse.c File Reference

GIS Library - Ellipse area routines. More...

#include <math.h>
#include <grass/gis.h>
#include "pi.h"
Include dependency graph for area_ellipse.c:

Go to the source code of this file.

Functions

void G_begin_zone_area_on_ellipsoid (double a, double e2, double s)
 Begin area calculations for ellipsoid. More...
 
double G_darea0_on_ellipsoid (double lat)
 Calculate integral for area between two latitudes. More...
 
double G_area_for_zone_on_ellipsoid (double north, double south)
 Calculates area between latitudes. More...
 

Detailed Description

GIS Library - Ellipse area routines.

(C) 2001-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL

Definition in file area_ellipse.c.

Function Documentation

◆ G_area_for_zone_on_ellipsoid()

double G_area_for_zone_on_ellipsoid ( double  north,
double  south 
)

Calculates area between latitudes.

This routine shows how to calculate area between two lats, but isn't efficient for row by row since G_darea0_on_ellipsoid() will be called twice for the same lat, once as a south then again as a north.

Returns the area between latitudes north and south scaled by the factor s passed to G_begin_zone_area_on_ellipsoid().

Parameters
northnorth coordinate
southsouth coordinate
Returns
cell area

Definition at line 89 of file area_ellipse.c.

References G_darea0_on_ellipsoid().

◆ G_begin_zone_area_on_ellipsoid()

void G_begin_zone_area_on_ellipsoid ( double  a,
double  e2,
double  s 
)

Begin area calculations for ellipsoid.

Initializes raster area calculations for an ellipsoid, where a is the semi-major axis of the ellipse (in meters), e2 is the ellipsoid eccentricity squared, and s is a scale factor to allow for calculations of part of the zone (s=1.0 is full zone, s=0.5 is half the zone, and s=360/ew_res is for a single grid cell).

Note: e2 must be positive. A negative value makes no sense, and zero implies a sphere.

Parameters
asemi-major axis
e2ellipsoid eccentricity
sscale factor

Definition at line 47 of file area_ellipse.c.

◆ G_darea0_on_ellipsoid()

double G_darea0_on_ellipsoid ( double  lat)

Calculate integral for area between two latitudes.

This routine is part of the integral for the area between two latitudes.

Parameters
latlatitude
Returns
cell area

Definition at line 63 of file area_ellipse.c.

References Radians, and x.

Referenced by G_area_for_zone_on_ellipsoid().