⇐ ⇒

[CF-metadata] bounds

From: Jonathan Gregory <j.m.gregory>
Date: Mon, 30 Jun 2003 15:37:53 +0100

Dear Brian and all

I think that the main cause of discomfort is the issue of how to decide which
side of a cell might adjoin another cell if they are not actually contiguous.
I suppose that is why you proposed restricting (n,m,2,2) to cells that are
contiguous. However that strikes me as inconvenient because it means you have
to reconfigure the boundary information from (n,m,2,2) to (n,m,4) if you drop
a row or a column from the middle. Also, (n,m,2,2) is particularly useful if
the cells are *not* all contiguous, because it makes it easy to know which
boundaries to check for coincidence, provided you are prepared to accept that
cell (j,i) is "next to" cell (j,i-1) in some sense, etc. That's the problem
raised in the first sentence.

I think that being "next to" really depends on the idea of an underlying xy
space in which the cells are actually arranged as a rectangular array. This is
not the case, for instance, for cells which are staggered on alternate rows
(like brickwork in a garden wall):

    * * * * * These cells could be stored in an (n,m) array
      * * * * * but they don't have an underlying coordinate
    * * * * * variable x(m) because there are two sets of
      * * * * * values for x.

In this arrangement it is ambiguous which cell might be regarded as next to a
cell vertically.

I think we can distinguish the case where there is a rectangular xy
arrangement formally by saying continuous x(m) and y(n) coordinates exist. By
continuous I mean they aren't just discrete indices. Continuous x and y exist
for map projections and a rotated pole, for example. Brian pointed out that
boundaries in x and y might not be stored so we can't use them to test
contiguousness. But if we know we do have the rectangular-xy case, we can
easily test contiguousness if we know which vertex is which. We don't have
to adopt (n,m,2,2) to be able to do that. We can do it just as well with
(n,m,4) if we define their ordering.

So here is another alternative proposal. There's no change for the 1D case (1)
and (2). In this proposal I use (n,m,p) for all other cases (as in the present
CF standard), but when x and y exist, they are ordered in a particular way so
contiguousness is easy to test. The only drawback I can see is that you can't
guarantee the vertices are ordered anticlockwise in the lon-lat plane.
However, they are definitely ordered anticlockwise in the xy plane.

By the way, I won't be at work from Sat 5th July for two weeks.

Best wishes

Jonathan


(3) In the case where the horizontal grid is described by two-dimensional
auxiliary coordinate variables in latitude lat(n,m) and longitude lon(n,m),
the associated cells are four-sided, and there exist continuous coordinate
variables x(m) and y(n), then the boundary variables are given in the form
latbnd(n,m,4) and lonbnd(n,m,4), where the trailing index runs over the four
vertices of the cells. Let us call the side of cell (j,i) facing cell (j,i-1)
the "i-1" side, the side facing cell (j,i+1) the "i+1" side, and similarly for
"j-1" and "j+1". Then we can refer to the vertex formed by sides i-1 and j-1
as (j-1,i-1). With this notation, the four vertices are indexed as follows:
0=(j-1,i-1), 1=(j-1,i+1), 2=(j+1,i+1), 3=(j+1,i-1).

If x-y-upward is a right-handed coordinate system (like lon-lat-upward), this
ordering means the vertices will be traversed anticlockwise on the lon-lat
surface seen from above. If x-y-upward is left-handed, they will be traversed
clockwise on the lon-lat surface.

The bounds can be used to decide whether cells are contiguous, as follows:

For 0 < j < n and 0 < i < m,

If cells (j,i) and (j,i+1) are contiguous, then

bnd(j,i,1)=bnd(j,i+1,0) and bnd(j,i,2)=bnd(j,i+1,3)

If cells (j,i) and (j+1,i) are contiguous, then

bnd(j,i,3)=bnd(j+1,i,0) and bnd(j,i,2)=bnd(j+1,i,1)

(4) In all other cases, the bounds should be dimensioned (...,n,p), where
(...,n) are the dimensions of the auxiliary coordinate variables, and p the
number of vertices of the cells. The vertices must be traversed anticlockwise
in the lon-lat plane as viewed from above. The starting vertex is not
specified by the standard.
Received on Mon Jun 30 2003 - 08:37:53 BST

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:40 BST

⇐ ⇒