Array coordinates


I would like to elaborate on my remark of yesterday that an arbitrary start value is a bad idea.

Arrays have 2 types of coordinates.

  • A pixel coordinate is formed by the index of an array element along each array axis. I think it is bad to have an arbitrary start value (a la good old Fortran) for them.
  • A world coordinate is the mapping of the pixel coordinate to the real world, e.g. a frequency, time, longitude, etc. I guess Mike referred to them when saying that array coordinates can have float values. Indeed they should have an arbitrary start value.

World coordinates are a can of worms. Often they are domain specific. In astronomy there is a special library (wcslib) to map pixel coordinates to world coordinates and vice-versa.
The sky is a sphere that has to be projected to a cartesian plane (like the Mercator projection). There are several such projections in wcslib. You cannot project per axis, but have to do longitude and latitude jointly.
It also means that regridding an astronomical image has to be done using a 2-dim interpolation, not two 1-dim interpolations.
Furthermore images might use different reference frames (e.g. J2000, B1950) which also needs taken care of when regridding.

Another problem with world coordinates is formed by the units. The user has to be aware if, say, longitude is stored in degrees, radians, or maybe hours (like right ascension). Hopefully SI units will be used everywhere.