World Ocean Circulation Experiment Global Data Resource |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home | Documents | Software/Resources | Help | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The algorithm reads: The fourth line says that if the right margin of the selection box is to the left of the left margin of the data or the left margin of the selection box is to the right of the right margin of the data there is no overlap and then (using !) negates it. A wrapped box is one where the left margin is numerically greater than the right margin. If there are no wrapped boxes no changes are made to s1,s2,d1 or d2 and the test is applied. What happens then when you have wrapped boxes? You can unwrap a wrapped selection box (more properly interval) in two ways: either reduce the left margin by 360 or increment the right margin by the same amount (these are the -=, += statements); In unwrapping the selection box you need to consider if the selection box left margin (s1) is numerically greater than the right margin (d2) of the data. This is one of the conditions for non-overlap (see 4'th line) Adding 360 to s2 at this point changes nothing. We need to look at the other possibility of reducing s1. If the data box is also wrapped we need to see which way to unwrap it. If the right margin of the selection box is left of the left margin of the data adding to the data's right margin does nothing. Instead we need to check the other possibility of numerically reducing the left margin of the data (d1). From this we deduce that the algorithm works irrespective of definition interval. E.g. [0,360) , [-180,180), (-180,180] or even [540,900), but note, you should as indicated exclude one of the endpoints, and that the data and selection definition intervals are the same. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||