Sequences, hyperslabs and selections
Joe Sirott
Joe.Sirott at noaa.gov
Mon May 29 21:09:10 PDT 2006
Hi Roberto,
The constraint takes precedence over the hyperslab operator. This topic
came up a few months ago in a private e-mail exchange between James
Gallagher, Ethan Davis and me a few months ago; I've attached James'
explanation below:
>
> >
> > Another spec issue -- what's the precedence of the array operator?
> > For instance, if I request:
> >
> > location[0:9].latitude?latitude>20
> >
> > do I get the first 10 values where the latitude > 20? Or just the
> > subset of latitude values in the first 10 values that are > 20?
>
The current behavior has the CE's evaluation broken into two phases:
First the CE is parsed and, as part of the parse, the projection
information is recorded. Then, as the data are sent, the selection
clauses are evaluated. In the current servers (and given NASA ESE SPG
'rules' that's what I must document in the spec) this means that a CE
like
values[0:99]&values.v1>200
will return the first 100 values where v1 is greater than 200, not
those values where v1 is > 200 found in the first 100 values.
Programatically what happens is that the rows are read from the
sequence starting at zero and proceeding to 99. A row is counted as
having been read if the relational constraint (selection) holds true.
Suppose these values:
v1
210
199
201
202
203
198
204
CE: values[0:2]&values.v1>200
210
201
202
CE: values[0:2]&values.v1<200
199
198
Note that there are not three values that satisfy the second CE.
Roberto De Almeida wrote:
> Hi, all. A quick question:
>
> If a client applies both a hyperslab and a selection on a sequence,
> what is the order of precedence? Eg, if I have the following dataset:
>
> Dataset {
> Sequence {
> Float64 lat;
> Float46 lon;
> } coastline;
> } coastline.db;
>
> And a client requests the following URL:
>
> http://example.com/coastline.db.dods?coastline[0:1:9]&coastline.lat>80
>
> Am I right to assume that the hyperslab should be applied *after*
> (return the first 10 items were latitude is greater than 80) the
> selection? This is not clear on the DAP 2 draft.
>
> Thanks,
> Roberto
More information about the Opendap-tech
mailing list