Date d1 = sod.getStartDate();
Date d2 = sod.getEndDate();
if ((d1 != null) && (d2 != null))
assert d1.before(d2) || d1.equals( d2);
DateUnit du = sod.getTimeUnits();
assert null != du;
double startVal = du.makeValue( d1);
double endVal = du.makeValue( d2);
assert startVal <= endVal;
Class dataClass = sod.getDataClass();
assert dataClass == StationObsDatatype.class;
List dataVars = sod.getDataVariables();
assert dataVars != null;
for (int i = 0; i < dataVars.size(); i++) {
VariableSimpleIF v = (VariableSimpleIF) dataVars.get(i);
assert null != sod.getDataVariable( v.getShortName());
}
List stations = sod.getStations();
assert null != stations;
assert 0 < stations.size();
System.out.println(" stations = "+stations.size());
int n = stations.size();
testStation( sod, (ucar.unidata.geoloc.Station) stations.get(0));
if (n > 3) {
testStation( sod, (ucar.unidata.geoloc.Station) stations.get(n-1));
testStation( sod, (ucar.unidata.geoloc.Station) stations.get((n-1)/2));
}
// make a new bb
LatLonRect bb = sod.getBoundingBox();
assert null != bb;
double h = bb.getUpperRightPoint().getLatitude() - bb.getLowerLeftPoint().getLatitude();
LatLonRect bb2 = new LatLonRect(bb.getLowerLeftPoint(), bb.getWidth()/2, h/2);
List<ucar.unidata.geoloc.Station> stationsBB= sod.getStations( bb2);
assert null != stationsBB;
assert stationsBB.size() <= stations.size();
System.out.println(" bb2 stations = "+stationsBB.size());
List data = sod.getData( bb2);
testData( sod.getTimeUnits(), data.iterator());
// make a new data range
double diff = endVal - startVal;
Date startRange = du.makeDate( startVal + .25 * diff);
Date endRange = du.makeDate( startVal + .75 * diff);
data = sod.getData( bb2, startRange, endRange);
testData( sod.getTimeUnits(), data.iterator());
data = sod.getData( stationsBB, startRange, endRange);
testData( sod.getTimeUnits(), data.iterator());