Geographic Functions

Table of Contents

  1. Introduction
  2. Divergence and Vorticity of Wind
  3. Land, Sea and Coast
  4. Things related to Latitude and Longitude
  5. Reading Geographic Files

Introduction

The following functions are defined in the files geog.tcl and land.tcl. Note that geog.tcl also defines Geographic Procedures.

Divergence and Vorticity of Wind

Functions div_wind(u,v) and vorticity_wind(u,v) gives the divergence (/second) and vorticity (/second) of a 2D wind, where
u is matrix containing zonal (x-component i.e. from west to east) wind in metres/sec.
v is matrix containing meridional (y-component i.e. from south to north) wind in metres/sec.
Coordinate variables of u and v are latitude (°N) and longitude (°E).

Let q be latitude in radians, j be longitude in radians, r be radius of earth in metres.

The divergence of a 2D wind is defined as
u/x + v/y
Function div_wind uses the equivalent formula
(u/j + (v cos q)/q) / (r cos q)

The vorticity of a 2D wind is defined as
v/x - u/y
Function vorticity_wind uses the equivalent formula
(v/j - (u cos q)/q) / (r cos q)

Land, Sea and Coast

is_land(latitude, longitude[, data_dir])

Produce a land/sea mask in the form of an i8 (8-bit signed integer) matrix with 1 for land and 0 for sea. The data has an accuracy of 0.01°.

The arguments latitude and longitude can be scalars, vectors or matrices. If they are either both vectors, or one is a vector and the other is a scalar, then they are used as the coordinate variables of the matrix result. Otherwise the result has the same shape and coordinate variables as the one of higher rank.

The optional argument data_dir is only needed if a non-standard data directory is to be used.

is_coast(latitude, longitude[, data_dir])

Produce an i8 (8-bit signed integer) matrix with 1 for coast and 0 otherwise. The data has an accuracy of 0.01°.

The arguments latitude and longitude are vectors. These are used to define the coordinate variables of the result.

The optional argument data_dir is only needed if a non-standard data directory is to be used.

Things related to Latitude and Longitude

area_on_globe(latitude, longitude)

Given latitude and longitude vectors, this function calculates a matrix whose values are fractions of the Earth's surface area.

Example:
% [nap "area_on_globe(-90 .. 0 ... 45, 0 .. 180 ... 45)"] value -format %.4f
0.0229 0.0092 0.0092 0.0092 0.0229
0.0781 0.0312 0.0312 0.0312 0.0781
0.2115 0.0846 0.0846 0.0846 0.2115

fix_longitude(longitude)

Adjust elements of longitude vector by adding or subtracting multiple of 360 to ensure:
−180 ≤ x0 < 180
0 ≤ xi+1xi < 360
Also ensure unit is degrees_east.

merid_wt(longitude)

Calculate normalised (so sum weights = 1) meridional weights from longitudes.

Example:
% [nap "merid_wt {-180 -90 -45 0 90 180}"]
0.125 0.1875 0.125 0.1875 0.25 0.125

zone_wt(latitude)

Calculate normalised (so sum weights = 1) zonal weights from latitudes.

Example:
% [nap "zone_wt(-90 .. 90 ... 30)"] value
0.0334936 0.125 0.216506 0.25 0.216506 0.125 0.0334936

Reading Geographic Files

acof2boxed(filename)

Read ascii cof (.acof) coastline file and return boxed nao.

Example:
nap "in = acof2boxed('abc.acof')"

get_gridascii(filename)

Read a file in ARC/INFO GRIDASCII format.

Example:
% nap "in = get_gridascii('abc.gridascii')"

Author: Harvey Davies       © 2002, CSIRO Australia.       Legal Notice and Disclaimer
CVS Version Details: $Id: geog.html,v 1.6 2004/11/17 00:48:50 dav480 Exp $