ODU SO GLOBEC: Grid
Software for Grid Calculations
The following matlab routines convert between latitude and longitude and
SOGLOBEC grid locations. The two routines getlatlon.m and getxy.m are short
driver routines that convert a list of locations between grid and
lat/lon. Included in these driver routines are some test locations and the
converts a list of grid locations (x,y) into the
equivalent latitude and longitude. (calls grid2ll.m)
converts a list of latitude longitude pairs to the equivalent grid
location. (calls ll2grid.m)
grid2ll.m is the routine that
converts from the SOGLOBEC grid location to true UTM and then to latitude
ll2grid.m is the routine that
converts latitude and longitude to true UTM and then to the SOGLOBEC grid
setuputm.m is a setup routine
that is called only once. It defines the offset and rotation between the UTM
coordinates and the SOGLOBEC grid. It also defines some parameters needed
by the UTM <-> lat/lon routines.
The following FORTRAN routines convert between latitude and longitude and
the SOGLOBEC grid location. The first two routines (getlatlon.f and getxy.f)
are main routines that read from standard input and write the answer to
standard output. The other fortran files contain support subroutines. There
is a Makefile for compiling and a c shell script to run tests of the
getlatlon.f reads a station
location (x.y) and converts to latitude and longitude. A series of locations
can be put into a file which is read sequentially, e.g. getlatlon < loc.in >
ll.out. (calls grid2ll.f).
getxy.f reads a latitude and
longitude pair from standard input and writes the grid location to standard
output. A series of locations can be put into a file which is read
sequentially, e.g. getxy < ll.in > loc.out. (calls ll2grid.f)
maketest is a c shell
script that tests both getlatlon and getxy using test input for which the
answers are known. This script also checks for differences between the
calculated answers and the expected answers. Due to slight differences in
calculations, the last digit of the answer might be different by one.
grid2ll.f converts from
SOGLOBEC grid locations to latitude and longitude. (calls utm2ll.f)
ll2grid.f converts from
latitude and longitude to SOGLOBEC grid locations. (calls ll2utm.f)
ll2utm.f is a routine that
converts from latitude and longitude to true UTM.
utm2ll.f converts a true UTM
location to latitude and longitude.
dtan.f is used in place of the
builtin double precision tangent routine.
Makefile is a make file to
compile the two main routines.
Routines to create cruise track, stations and grid
Go to the top of this page.
Written by J. Klinck
Send questions or comments by e-mail to