Closed GoogleCodeExporter closed 8 years ago
I think you want
lat[(lat[:] > 35) & (lat[:] < 45)]
which is equivalent to
lat[(np.asarray(lat) > 35) & (np.asarray(lat) < 45)]
You have to slice the variable first to read the data.
lat > 35 just evaluates to True. I suppose I could override the __gt__
operator to first read the data and then do the comparison - I'll think more on
that.
Original comment by whitaker.jeffrey@gmail.com
on 21 Jun 2013 at 2:42
But that will download whole data if Dataset is remote...
I guess I expected too much ;)
Original comment by klo...@gmail.com
on 22 Jun 2013 at 3:20
I meant, I was hoping that protocol (opendap for example) allows such queries
that can be mapped to numpy array slicing properties, but wasn't sure
Original comment by klo...@gmail.com
on 22 Jun 2013 at 3:23
You typically will only use coordinate variables for this, and they are 1-d
arrays (so the overhead of reading the data is not too large). There's no way
I know of to avoid reading the data to perform these kinds of comparison
operations.
Original comment by whitaker.jeffrey@gmail.com
on 22 Jun 2013 at 4:58
Yes, for coordinates it isn't a problem. And maybe there is no interface for
such binary query exposed anywhere, but I don't know...
I was trying to understand nco operators, if maybe they allow such
manipulation, but their manual is very confusing to me, right now
Thanks Jeff
Original comment by klo...@gmail.com
on 22 Jun 2013 at 6:12
Original comment by whitaker.jeffrey@gmail.com
on 26 Feb 2014 at 2:04
Original issue reported on code.google.com by
klo...@gmail.com
on 20 Jun 2013 at 11:12