grump

package
v0.0.0-...-1bee6ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package grump contains function to process data of a GRUMP file describing the country density into a body file that can be fed into the simulator.

GRUMP is the acronym for "Global Rural-Urban Mapping Project"; this is a freely available data source of population density.

Index

Constants

View Source
const GrumpSpacing float64 = 0.0083333333333

GrumpSpacing is side length in degrees of the input data unit square

Variables

View Source
var (
	Trace   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
)

Functions

func AddBodiesOfParselyPopulatedCells

func AddBodiesOfParselyPopulatedCells(
	startRow, endRow int,
	country *Country,
	parselyPopulatedCellCoords [][]bool,
	inputPopulationMatrix [][]float64,
	colLngWidth float64,
	cutoff float64,
	sampleRatio float64,
	bodies []quadtree.Body,
	popInParselyPopulatedCells, notAccountedForPop *float64)

func Init

func Init(
	traceHandle io.Writer,
	infoHandle io.Writer,
	warningHandle io.Writer,
	errorHandle io.Writer)

func PrintMemUsage

func PrintMemUsage()

Types

type Country

type Country struct {
	Name         string
	NCols, NRows int

	// XllCorner is longitude of the lower left corner, in degress
	XllCorner float64

	// XYlCorner is latitude of the lower left corner, in degress
	YllCorner float64
}

Country stores country meta data

func (*Country) LatLng2XY

func (country *Country) LatLng2XY(lat, lng float64) (x, y float64)

LatLng2XY gives from lat/lng, the relative coordinate within the country

func (*Country) Row2Lat

func (country *Country) Row2Lat(row int) (lat float64)

Row2Lat converts from row index to lat

func (*Country) Serialize

func (country *Country) Serialize()

Serialize into a coord file

func (*Country) Unserialize

func (country *Country) Unserialize()

Unserialize inits struct from a coord file

func (*Country) XY2LatLng

func (country *Country) XY2LatLng(x, y float64) (lat, lng float64)

XY2LatLng gives from lat/lng, the relative coordinate within the country

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL