|
|
|||
|
||||
On Jun 3, 2006, at 11:30 AM, Govind Kabra wrote: Hi all, In DAP version 2, which is the protocol supported by essentially all of the DAP-compliant servers, relational operators cannot be applied to array variables. This is unfortunate since it clearly makes sense, but in a completely general case the result is a Sequence (i.e., a table of values) and many programs designed to read array data won't work with table data unless it's repackaged in the form of an array. However, all is not lost! The newer servers from OPeNDAP have a server-side function named 'grid' which can be used to apply a relational constraint on one or more Map variables in a Grid. The function can actually be called by the data handler, so it should work in your case as well as for people reading data from servers over the network; for your example it would look like: dap_nc_handler -o DataDDS -e 'grid(air,"time<657075")' test_data/air.mean.nc You can play with this function using our test server and its data sets (although the function should be available on all servers at version 3.4 or greater): otaku:~ jimg$ getdap -D 'http://test.opendap.org/dap/data/nc/coads_climatology.nc?grid(SST,"4000<TIME<5000")' returns: The data: Grid { Array: Float32 SST[TIME = 2][COADSY = 90][COADSX = 180]; Maps: Float64 TIME[TIME = 2]; Float64 COADSY[COADSY = 90]; Float64 COADSX[COADSX = 180]; } SST = { Array: {{{-1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e +34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e +34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e +34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e +34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e+34, -1e . . . }}} Maps: {4018.425, 4748.91}, {-89, -87, -85, -83, -81, -79, -77, -75, -73, -7 1, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -3 9, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89}, {21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45 , 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85 , 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379} }; A more interesting (or presentable) constraint for an email message is otaku:~ jimg$ getdap -D 'http://test.opendap.org/dap/data/nc/coads_climatology.nc?grid(SST,"4000<TIME<5000","201<=COADSX<=205","0<=COADSY<=52")' The data: Grid { Array: Float32 SST[TIME = 2][COADSY = 26][COADSX = 3]; Maps: Float64 TIME[TIME = 2]; Float64 COADSY[COADSY = 26]; Float64 COADSX[COADSX = 3]; } SST = { Array: {{{27.9775, 27.6321, 27.575},{28.1685, 28.1637, 27.95},{28.2286, 28.4093, 28.2132},{28.0266, 28.1059, 28.1066},{27.8035, 27.5656, 27.7148},{27.2464, 26.9808, 26.942},{26.4742, 26.4889, 26.4327},{26.2997, 26.2144, 26.0522},{25.9369, 25.7234, 25.3337},{25.9681, 25.7718, 25.2551},{25.7148, 25.4364, 24.99},{25.3407, 25.0164, 24.7544},{24.6726, 24.7322, 24.5826},{24.3369, 24.2189, 23.9621},{23.7692, 23.5003, 23.6015},{22.7074, 22.5286, 22.3576},{20.933, 21.1083, 21.0249},{19.2586, 19.2349, 19.4712},{16.9556, 17.1069, 17.3766},{15.2445, 15.2688, 15.449},{13.0346, 13.0533, 13.2305},{11.1483, 11.1845, 11.5527},{9.44238, 9.64071, 9.71535},{8.26405, 8.45143, 8.67},{7.57024, 7.65333, 7.77048},{7.05293, 7.24171, 7.29439}},{{27.5438, 27.25, 27.3214},{28.0796, 27.8169, 27.79},{28.1694, 28.173, 28.039},{28.2092, 28.1547, 28.0568},{27.9376, 27.4518, 27.6673},{27.5753, 27.1333, 27.1671},{26.8152, 26.6597, 26.7769},{26.7854, 26.4313, 26.3846},{26.734, 26.1247, 25.966},{26.4682, 26.1405, 25.7042},{26.3584, 25.8607, 25.4656},{25.7332, 25.4537, 25.2402},{25.4874, 25.1466, 25.1838},{25.2611, 24.7237, 24.6776},{24.78, 24.3369, 24.4874},{24.2688, 23.8714, 23.6362},{23.4614, 23.1251, 22.8595},{22.5207, 22.2679, 21.986},{20.7998, 20.888, 20.6961},{19.0915, 19.0938, 18.9875},{16.9456, 16.9454, 17.0924},{14.3, 14.6368, 14.7617},{12.3895, 12.3724, 12.6052},{10.9215, 11.0539, 11.2395},{10.0356, 10.1138, 10.2349},{9.53122, 9.74829, 9.81976}}} Maps: {4018.425, 4748.91}, {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}, {201, 203, 205} }; Here's an error when the values for the Maps don't fall within the bounds of the relational constraint: otaku:~ jimg$ getdap -D 'http://test.opendap.org/dap/data/nc/coads_climatology.nc?grid(SST,"4000<TIME<5000","-75<COADSX<-69","201<COADSY<205")' "The selection range given does not correspond to any values of COADSY. The vector's values range from -89 to 89." Note that there are some limitations to what the grid() server-side function can do. It doesn't know about Latitude or Longitude and it assumes that the Map vectors are monotonic. The function scans for high and low values from the ends of the Maps inwards, so if a Map is not monotonic, it will return all the values that satisfy the relational _expression_, plus some that don't. Hope this helps. James
-- James Gallagher jgallagher at opendap.org OPeNDAP, Inc 406.723.8663 |
| Contact Us Site Map Search Terms and Conditions Privacy Policy Participation Policy | ||||||
|
||||||