Examples of LatLonRect


Examples of ucar.unidata.geoloc.LatLonRect

      NetcdfDataset ncd = new NetcdfDataset(ncremote, null);
      return new GridDataset(ncd);

    } else {
      List<VariableSimpleIF> dataVars = FeatureDatasetPointXML.getDataVariables(doc);
      LatLonRect bb = FeatureDatasetPointXML.getSpatialExtent(doc);
      DateRange dr = FeatureDatasetPointXML.getTimeSpan(doc);

      return new PointDatasetRemote(ft, uri, dataVars, bb, dr);
    }
  }
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

        GridDataset gridDataset = (GridDataset) result.featureDataset;
        return extractGeospatial( gridDataset);

      } else if (result.featureType == FeatureType.POINT) {
        PointObsDataset pobsDataset = (PointObsDataset) result.featureDataset;
        LatLonRect llbb = pobsDataset.getBoundingBox();
        if (null != llbb) {
          ThreddsMetadata.GeospatialCoverage gc = new ThreddsMetadata.GeospatialCoverage();
          gc.setBoundingBox(llbb);
          return gc;
        }
      } else if (result.featureType == FeatureType.STATION) {
        StationObsDataset sobsDataset = (StationObsDataset) result.featureDataset;
        LatLonRect llbb = sobsDataset.getBoundingBox();
        if (null != llbb) {
          ThreddsMetadata.GeospatialCoverage gc = new ThreddsMetadata.GeospatialCoverage();
          gc.setBoundingBox(llbb);
          return gc;
        }
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

    return null;
  }

  static public ThreddsMetadata.GeospatialCoverage extractGeospatial(GridDataset gridDataset) {
    ThreddsMetadata.GeospatialCoverage gc = new ThreddsMetadata.GeospatialCoverage();
    LatLonRect llbb = null;
    CoordinateAxis1D vaxis = null;

    for(GridDataset.Gridset gridset : gridDataset.getGridsets()) {
      GridCoordSystem gsys = gridset.getGeoCoordSystem();
      if (llbb == null)
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

    vars.sort();
    return vars;
  }

  static public ThreddsMetadata.GeospatialCoverage extractGeospatial(FeatureDatasetPoint fd) {
    LatLonRect llbb = fd.getBoundingBox();
    if (llbb != null) {
      ThreddsMetadata.GeospatialCoverage gc = new ThreddsMetadata.GeospatialCoverage();
      gc.setBoundingBox(llbb);
      return gc;
    }
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

      System.out.println("  empty " + pfc.getName());
      //pfc.calcBounds();
      return 0; // empty
    }

    LatLonRect bb = pfc.getBoundingBox();
    assert bb != null;
    DateRange dr = pfc.getDateRange();
    assert dr != null;

    // read all the data - check that it is contained in the bbox, dateRange
    if (show) System.out.println(" complete iteration");
    long start = System.currentTimeMillis();
    int count = 0;
    pfc.resetIteration();
    while (pfc.hasNext()) {
      PointFeature pf = pfc.next();
      checkPointFeature(pf);
      assert bb.contains(pf.getLocation().getLatLon()) : pf.getLocation().getLatLon();
      if (!dr.contains(pf.getObservationTimeAsDate()))
        System.out.printf("  date out of Range= %s on %s %n", pf.getObservationTimeAsDate(), pfc.getName());
      count++;
    }
    long took = System.currentTimeMillis() - start;
    if (show)
      System.out.println(" testPointFeatureCollection complete count= " + count + " full iter took= " + took + " msec");

    // subset with a bounding box, test result is in the bounding box
    LatLonRect bb2 = new LatLonRect(bb.getLowerLeftPoint(), bb.getHeight() / 2, bb.getWidth() / 2);
    PointFeatureCollection subset = pfc.subset(bb2, null);
    if (show) System.out.println(" subset bb= " + bb2.toString2());

    start = System.currentTimeMillis();
    int counts = 0;
    PointFeatureIterator iters = subset.getPointFeatureIterator(-1);
    while (iters.hasNext()) {
      PointFeature pf = iters.next();
      assert pf != null;
      assert pf.getLocation() != null;

      assert bb2.contains(pf.getLocation().getLatLon()) : bb2.toString2() + " does not contains point " + pf.getLocation().getLatLon();
      //System.out.printf(" contains point %s%n",pf.getLocation().getLatLon());

      checkPointFeature(pf);
      counts++;
    }
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

  int checkStationFeatureCollection(StationTimeSeriesFeatureCollection sfc) throws IOException {
    System.out.printf("--------------------------\nComplete Iteration for %s %n", sfc.getName());
    int countStns = countLocations(sfc);

    // try a subset
    LatLonRect bb = sfc.getBoundingBox();
    assert bb != null;
    LatLonRect bb2 = new LatLonRect(bb.getLowerLeftPoint(), bb.getHeight() / 2, bb.getWidth() / 2);
    System.out.println("Subset= " + bb2.toString2());
    StationTimeSeriesFeatureCollection sfcSub = sfc.subset(bb2);
    int countSub = countLocations(sfcSub);
    assert countSub <= countStns;

    System.out.println("Flatten= " + bb2.toString2());
    PointFeatureCollection flatten = sfc.flatten(bb2, null);
    int countFlat = countLocations(flatten);
    assert countFlat <= countStns;

    flatten = sfc.flatten(null, null);
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

    if (fc instanceof PointFeatureCollection) {
      PointFeatureCollection pfc = (PointFeatureCollection) fc;
      countLocations(pfc);

      LatLonRect bb = pfc.getBoundingBox();
      LatLonRect bb2 = new LatLonRect(bb.getLowerLeftPoint(), bb.getHeight() / 2, bb.getWidth() / 2);
      PointFeatureCollection subset = pfc.subset(bb2, null);
      countLocations(subset);

    } else if (fc instanceof StationTimeSeriesFeatureCollection) {
      StationTimeSeriesFeatureCollection sfc = (StationTimeSeriesFeatureCollection) fc;
      PointFeatureCollection pfcAll = sfc.flatten(null, null);
      System.out.printf("Unique Locations all = %d %n", countLocations(pfcAll));

      LatLonRect bb = sfc.getBoundingBox();
      assert bb != null;
      LatLonRect bb2 = new LatLonRect(bb.getLowerLeftPoint(), bb.getHeight() / 2, bb.getWidth() / 2);
      PointFeatureCollection pfcSub = sfc.flatten(bb2, null);
      System.out.printf("Unique Locations sub1 = %d %n", countLocations(pfcSub));

      StationTimeSeriesFeatureCollection sfcSub = sfc.subset(bb2);
      PointFeatureCollection pfcSub2 = sfcSub.flatten(null, null);
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

  private void testPointVsAny(String file, boolean showIO) throws IOException {
    long start = System.currentTimeMillis();
    if (showIO)
      ucar.unidata.io.RandomAccessFile.setDebugAccess(true);

    LatLonRect llr = new LatLonRect(new LatLonPointImpl(33.4, -92.2), new LatLonPointImpl(47.9, -75.89));
    System.out.println("subset box = " + llr);

    Formatter buf = new Formatter();
    FeatureDatasetPoint pods = (FeatureDatasetPoint) FeatureDatasetFactoryManager.open(ucar.nc2.constants.FeatureType.POINT, file, null, buf);
    if (pods != null) {
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

      throw new IOException("can't open file error=" + buf);
    }

    List<FeatureCollection> collectionList = pods.getPointFeatureCollectionList();
    FeatureCollection fc = collectionList.get(0);
    LatLonRect llr = new LatLonRect(new LatLonPointImpl(33.4, -92.2), new LatLonPointImpl(47.9, -75.89));
    System.out.println("llr = " + llr);

    PointFeatureCollection collection = null;
    if (fc instanceof PointFeatureCollection) {
      collection = (PointFeatureCollection) fc;
      if (llr != null) {
        collection = collection.subset(llr, null);
      }
    } else if (fc instanceof NestedPointFeatureCollection) {
      NestedPointFeatureCollection npfc = (NestedPointFeatureCollection) fc;
      // npfc = npfc.subset(llr);
      collection = npfc.flatten(llr, null);
    } else {
      throw new IllegalArgumentException("Can't handle collection of type " + fc.getClass().getName());
    }

    PointFeatureIterator dataIterator = collection.getPointFeatureIterator(-1);
    try {
      int numObs = 0;
      while (dataIterator.hasNext()) {
        PointFeature po = (PointFeature) dataIterator.next();
        numObs++;
        ucar.unidata.geoloc.EarthLocation el = po.getLocation();
        assert llr.contains(el.getLatLon()) : el.getLatLon();
        if (numObs % 1000 == 0)
          System.out.printf("%d el = %s %n", numObs, el);
      }

      long took = System.currentTimeMillis() - start;
View Full Code Here

Examples of ucar.unidata.geoloc.LatLonRect

    //pods.calcBounds();
    System.out.printf("Opened file %s%n dateRange= %s", file, pods.getDateRange());

    List<FeatureCollection> collectionList = pods.getPointFeatureCollectionList();
    FeatureCollection fc = collectionList.get(0);
    LatLonRect llr = new LatLonRect(new LatLonPointImpl(33.4, -92.2), new LatLonPointImpl(47.9, -75.89));
    System.out.println("llr = " + llr);

    DateRange dr;
    if (usePresent) {
      //Date now = new Date();
      //Date ago = new Date(now.getTime()-3600000);
      dr = new DateRange(null, new DateType(true, null), new TimeDuration("2 hour"), null);

      //dr = new DateRange(null, new DateType(true, null), new TimeDuration("1 hour"), null);
      //dr = new DateRange(dr.getStart().getDate(), dr.getEnd().getDate()); // get rid of reletive time
    } else {
      Date startd = pods.getDateRange().getStart().getDate();
      dr = new DateRange(startd, new TimeDuration("1 hour"));
    }
    System.out.println("date range = " + dr);

    long start = System.currentTimeMillis();
    PointFeatureCollection collection = null;
    if (fc instanceof PointFeatureCollection) {
      collection = (PointFeatureCollection) fc;
      if (llr != null) {
        collection = collection.subset(llr, dr);
      }
    } else if (fc instanceof NestedPointFeatureCollection) {
      NestedPointFeatureCollection npfc = (NestedPointFeatureCollection) fc;
      collection = npfc.flatten(llr, dr);
    } else {
      throw new IllegalArgumentException("Can't handle collection of type " + fc.getClass().getName());
    }

    DateRange track = null;
    DateFormatter df = new DateFormatter();
    PointFeatureIterator dataIterator = collection.getPointFeatureIterator(-1);
    int numObs = 0;
    while (dataIterator.hasNext()) {
      PointFeature po = (PointFeature) dataIterator.next();
      numObs++;
      ucar.unidata.geoloc.EarthLocation el = po.getLocation();
      StructureData structure = po.getData();
      assert llr.contains(el.getLatLon()) : el.getLatLon() + " not in " + llr;

      Date obsDate = po.getObservationTimeAsDate();
      assert dr.included(obsDate) : df.toDateTimeString(obsDate) + " not in " + dr;
      if (numObs % 1000 == 0)
        System.out.printf("%d el = %s %s %n", numObs, el, df.toDateTimeString(obsDate));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.