Package ucar.nc2.dataset

Examples of ucar.nc2.dataset.CoordinateAxis1DTime


    HashSet<Date> dateHash = new HashSet<Date>();
    List<CoordinateAxis1DTime> timeAxes = new ArrayList<CoordinateAxis1DTime>();

    for (GridDatatype grid : grids) {
      GridCoordSystem gcs = grid.getCoordinateSystem();
      CoordinateAxis1DTime timeAxis = gcs.getTimeAxis1D();
      if ((timeAxis != null) && !timeAxes.contains(timeAxis)) {
        timeAxes.add(timeAxis);

        Date[] timeDates = timeAxis.getTimeDates();
        for (Date timeDate : timeDates)
          dateHash.add(timeDate);
      }
    }
    dates = Arrays.asList( dateHash.toArray(new Date[dateHash.size()]));
View Full Code Here


  public List<Date> getDates() { return dates; }

  public boolean hasTime( GridDatatype grid, Date date) {
    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1DTime timeAxis = gcs.getTimeAxis1D();
    return (timeAxis != null) && timeAxis.hasTime( date);
  }
View Full Code Here

  }

  public Point readData(GridDatatype grid, Date date, double lat, double lonthrows java.io.IOException {
    GridCoordSystem gcs = grid.getCoordinateSystem();

    CoordinateAxis1DTime timeAxis = gcs.getTimeAxis1D();
    int tidx = timeAxis.findTimeIndexFromDate( date);

    int[] xy = gcs.findXYindexFromLatLonBounded(lat, lon, null);

    Array data  = grid.readDataSlice(tidx, -1, xy[1], xy[0]);
View Full Code Here

  }

  public Point readData(GridDatatype grid, Date date, double zCoord, double lat, double lonthrows java.io.IOException {
    GridCoordSystem gcs = grid.getCoordinateSystem();

    CoordinateAxis1DTime timeAxis = gcs.getTimeAxis1D();
    int tidx = timeAxis.findTimeIndexFromDate( date);

    CoordinateAxis1D zAxis = gcs.getVerticalAxis();
    int zidx = zAxis.findCoordElement( zCoord);

    int[] xy = gcs.findXYindexFromLatLon(lat, lon, null);
View Full Code Here

      GridCoordSystem gcsys = grid.getCoordinateSystem();
      assert gcsys.getYHorizAxis() != null;
      assert gcsys.getXHorizAxis() != null;
      assert gcsys.getTimeAxis() != null;

      CoordinateAxis1DTime taxis = gcsys.getTimeAxis1D();
      assert taxis.getDataType() == DataType.STRING : taxis.getDataType();

      List names = taxis.getNames();
      java.util.Date[] dates = taxis.getTimeDates();
      assert dates != null;
      for (int i = 0; i < dates.length; i++) {
        Date d = dates[i];
        ucar.nc2.util.NamedObject name = (ucar.nc2.util.NamedObject) names.get(i);
        System.out.println(name.getName()+" == "+d);
View Full Code Here

    GridDatatype grid = gridDs.findGridDatatype(gridName);
    assert (grid != null) : "Cant find grid "+gridName;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1DTime runtime = gcs.getRunTimeAxis();
    assert (runtime != null) : "Cant find runtime for "+gridName;
    CoordinateAxis time = gcs.getTimeAxis();
    assert (time != null) : "Cant find time for "+gridName;
    assert (time.getRank() == 2) : "Time should be 2D "+gridName;

    if (showCount) {
      System.out.println(" runtimes=" + runtime.getSize());
      System.out.println(" ntimes=" +  time.getDimension(1).getLength());
    }

    if (ngrids >= 0)
      assert ngrids == countGrids : "Grids " + ngrids + " != " + countGrids;
    //if (ncoordSys >= 0)
    //  assert ncoordSys == countCoordSys : "CoordSys " + ncoordSys + " != " + countCoordSys;
    if (ncoordAxes >= 0)
      assert ncoordAxes == countCoordAxes : "CoordAxes " + ncoordAxes + " != " + countCoordAxes;
    if (nVertCooordAxes >= 0)
      assert nVertCooordAxes == countVertCooordAxes : "VertAxes" + nVertCooordAxes + " != " + countVertCooordAxes;

    if (nruns >= 0)
      assert runtime.getSize() == nruns : runtime.getSize()+" != "+ nruns;
    if (nruns >= 0)
      assert time.getDimension(0).getLength() == nruns : " nruns should be "+ nruns;
    if (ntimes >= 0)
      assert time.getDimension(1).getLength() == ntimes : " ntimes should be "+ ntimes;
View Full Code Here

    GridDatatype grid = gridDs.findGridDatatype(gridName);
    assert (grid != null) : "Cant find grid "+gridName;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1DTime runtime = gcs.getRunTimeAxis();
    //System.out.println(" has runtime axis=" +  (runtime != null));

    assert (runtime != null) : "Cant find runtime for "+gridName;
    //assert (runtime == null) : "Should not have runtime coord= "+runtime;
View Full Code Here

    for (GridDatatype gg : gds.getGrids()) {
      GridCoordSystem gcs = gg.getCoordinateSystem();
      Grid grid = new Grid(gg.getFullName());

      // LOOK: Note this assumes a dense coordinate system
      CoordinateAxis1DTime axis = gcs.getTimeAxis1D();
      if (axis != null) {
        TimeCoord tc = getTimeCoordinate(axis);
        tc.addGridInventory(grid);
        grid.tc = tc;
      }
View Full Code Here

        if (v == null) {
          logger.warn("readTimeCoordinates: variable = " + timeAxis.getFullName() + " not found in file " + dataset.getLocation());
          return;
        }
        VariableDS vds = (v instanceof VariableDS) ? (VariableDS) v : new VariableDS( null, v, true);
        CoordinateAxis1DTime timeCoordVar = CoordinateAxis1DTime.factory(ncDataset, vds, null);
        java.util.Date[] dates = timeCoordVar.getTimeDates();
        dateList.addAll(Arrays.asList(dates));

        if (timeUnits == null)
          timeUnits = v.getUnitsString();
View Full Code Here

    for (GridDataset.Gridset gridset : gridDataset.getGridsets()) {
      GridCoordSystem gsys = gridset.getGeoCoordSystem();
      DateRange dateRange;

      CoordinateAxis1DTime time1D = gsys.getTimeAxis1D();
      if (time1D != null) {
        dateRange = time1D.getDateRange();
      } else {
        CoordinateAxis time = gsys.getTimeAxis();
        if (time == null)
          continue;
       
View Full Code Here

TOP

Related Classes of ucar.nc2.dataset.CoordinateAxis1DTime

Copyright © 2018 www.massapicom. 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.