Longitude,Latitude to i,j Converter Print

This tool converts longitude,latitude values to HYCOM i,j values. The tool hycom_lonlat2ij in the HYCOM source distribution requires one latitude value, one longitude value, and the respective grid.a file for the HYCOM model you are working with.

hycom_lonlat2ij - Usage:

hycom_lonlat2ij lon lat [grid.a]
hycom_lonlat2ij [grid.a] < lonlat.txt

Prints the nearest HYCOM p-grid point to lon,lat. A single lon,lat can be specified on the command line, or a sequence of lon,lat pairs can be input from stdin. grid.a is a hycom grid file, default regional.grid.a. Note that the corresponding grid.b must also exist. This version for "serial" Unix systems. Written by Alan J. Wallcraft, Naval Research Laboratory, November 2001.

hycom_latlon2ij is in the 2.2.18_ALL.tar.gz bundle, from hycom/ALL/bin/hycom_lonlat2ij.F:

C  hycom_lonlat2ij - Usage:  hycom_lonlat2ij lon lat [grid.a]
C                            hycom_lonlat2ij [grid.a] < lonlat.txt
C
C  hycom_lonlat2ij_area - Usage:  hycom_lonlat2ij_area lon lat [grid.a]
C                                 hycom_lonlat2ij_area [grid.a] < lonlat.txt
C
C     Prints the nearest HYCOM p-grid point to lon,lat.
C     The _area varient adds grid point's cell area and cell area statistics
C
C     A single lon,lat can be specified on the command line,
C     or a sequence of lon,lat pairs can be input from stdin.
C
C  grid.a is a hycom grid file, default regional.grid.a.
C  Note that the corresponding grid.b must also exist.

In the rectilinear part of the grid (south of 47N) i is independent of latitude and j is independent of longitude:

ajax 189> hycom_lonlat2ij 90 0
  199 1505
ajax 190> hycom_lonlat2ij 90 30
  199 1898
ajax 191> hycom_lonlat2ij 0 30
 3574 1898

North of 47N this isn't the case:

ajax 192> hycom_lonlat2ij 90 70
  552 3084
ajax 193> hycom_lonlat2ij 90 80
  825 3206
ajax 194>  hycom_lonlat2ij 0 80
 3459 2995