Package ucar.nc2.dataset

Examples of ucar.nc2.dataset.CoordinateAxis$AxisComparator


  }

  public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) throws IOException {
    TableConfig topTable = new TableConfig(Table.Type.Top, "singleTrajectory");

    CoordinateAxis coordAxis = CoordSysEvaluator.findCoordByType(ds, AxisType.Time);
    if (coordAxis == null) {
      errlog.format("Cant find a time coordinate");
      return null;
    }
    Dimension innerDim = coordAxis.getDimension(0);
    boolean obsIsStruct = Evaluator.hasRecordStructure(ds) && innerDim.isUnlimited();

    TableConfig obsTable = new TableConfig(Table.Type.Structure, innerDim.getName());
    obsTable.dimName = innerDim.getName();
    obsTable.time = coordAxis.getFullName();
    obsTable.structName = obsIsStruct ? "record" : innerDim.getName();
    obsTable.structureType = obsIsStruct ? TableConfig.StructureType.Structure : TableConfig.StructureType.PsuedoStructure;
    CoordSysEvaluator.findCoordWithDimension(obsTable, ds, innerDim);

    topTable.addChild(obsTable);
View Full Code Here


   */

   public TableConfig getConfig(FeatureType wantFeatureType, NetcdfDataset ds, Formatter errlog) {
    Dimension obsDim = ds.getUnlimitedDimension();
    if (obsDim == null) {
      CoordinateAxis axis = CoordSysEvaluator.findCoordByType(ds, AxisType.Time);
      if ((axis != null) && axis.isScalar())
        obsDim = axis.getDimension(0);
    }

    if (obsDim == null) {
      errlog.format("Must have an Observation dimension: unlimited dimension, or from Time Coordinate");
      return null;
View Full Code Here

    assert grid.getRank() == 4;

    Array data = grid.readDataSlice(0, -1, -1, -1);
    assert data.getRank() == 3;

    CoordinateAxis zaxis = gcs.getVerticalAxis();
    assert data.getShape()[0] == zaxis.getSize() : zaxis.getSize();

    CoordinateAxis yaxis = gcs.getYHorizAxis();
    assert data.getShape()[1] == yaxis.getSize() : yaxis.getSize();

    CoordinateAxis xaxis = gcs.getXHorizAxis();
    assert data.getShape()[2] == xaxis.getSize() : xaxis.getSize();

    VerticalTransform vt = gcs.getVerticalTransform();
    assert vt != null;
    assert vt.getUnitString() != null;

    ucar.ma2.ArrayDouble.D3 vcoord = vt.getCoordinateArray(0);
    assert vcoord.getShape()[0] ==  zaxis.getSize() : vcoord.getShape()[0];
    assert vcoord.getShape()[1] ==  yaxis.getSize() : vcoord.getShape()[1];
    assert vcoord.getShape()[2] ==  xaxis.getSize() : vcoord.getShape()[2];
  }
View Full Code Here

        /*
         * NetCDF files declare axes in reverse order, so we iterate in the 'netcdfAxes'
         * list in reverse order for adding to the 'axes' list in "natural" order.
         */
        while (--targetDim >= 0) {
            final CoordinateAxis  axis = range.get(targetDim);
            final List<Dimension> axisDomain = axis.getDimensions();
            AttributeNames.Dimension attributeNames = null;
            final AxisType type = axis.getAxisType();
            if (type != null) switch (type) {
                case Lon:      attributeNames = AttributeNames.LONGITUDE; break;
                case Lat:      attributeNames = AttributeNames.LATITUDE; break;
                case Pressure: // Fallthrough: consider as Height
                case Height:   attributeNames = AttributeNames.VERTICAL; break;
View Full Code Here

        final ColorModel colorModel = ImageIOUtilities.createColorModel(sampleModel);
   
        final WritableRaster raster = Raster.createWritableRaster(sampleModel, new Point(0, 0));
        final BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null);

        CoordinateAxis axis = wrapper.variableDS.getCoordinateSystems().get(0).getLatAxis();
        boolean flipYAxis = false;
        try {
            Array yAxisStart = axis.read(new Section().appendRange(2));
            float y1 = yAxisStart.getFloat(0);
            float y2 = yAxisStart.getFloat(1);
            if (y2 > y1) {
                flipYAxis=true;
            }
View Full Code Here

        }
        return feature;
    }

    private String getTimeAttribute(CoordinateSystem cs) {
        CoordinateAxis timeAxis = cs.getTaxis();
        String name = timeAxis.getFullName();
        String timeAttribute = reader.dimensionsMapping.get(name.toUpperCase());
        if (timeAttribute == null) {
            timeAttribute = reader.dimensionsMapping.get(NetCDFUtilities.TIME_DIM);
        }
        return timeAttribute;
View Full Code Here

        Dimension dim = dataset.findDimension("time");
        assertNotNull(dim);
        assertEquals("time", dim.getShortName());

        // check type
        CoordinateAxis coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        Class<?> binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Date.class, binding);
View Full Code Here

        Dimension dim = dataset.findDimension("cloud_formations");
        assertNotNull(dim);
        assertEquals("cloud_formations", dim.getShortName());

        // check type
        CoordinateAxis coordinateAxis = dataset.findCoordinateAxis(dim.getShortName());
        assertNotNull(coordinateAxis);
        assertTrue(coordinateAxis instanceof CoordinateAxis1D);
        Class<?> binding = CoordinateVariable.suggestBinding((CoordinateAxis1D) coordinateAxis);
        assertNotNull(binding);
        assertSame(Short.class, binding);
View Full Code Here

            assertNotNull(dataset);
            final List<CoordinateAxis> cvs = dataset.getCoordinateAxes();
            assertNotNull(cvs);
            assertSame(4, cvs.size());

            CoordinateAxis timeAxis = cvs.get(0);
            assertNotNull(timeAxis);
            assertEquals(AxisType.Time, timeAxis.getAxisType());

            final TemporalCRS temporalCrs = NetCDFCRSUtilities.buildTemporalCrs(timeAxis);
            assertNotNull(temporalCrs);
            assertTrue(temporalCrs instanceof DefaultTemporalCRS);

            CoordinateAxis verticalAxis = cvs.get(1);
            assertNotNull(verticalAxis);
            assertEquals(AxisType.Height, verticalAxis.getAxisType());

            final VerticalCRS verticalCrs = NetCDFCRSUtilities.buildVerticalCrs(verticalAxis);
            assertNotNull(verticalCrs);
            assertTrue(verticalCrs instanceof DefaultVerticalCRS);
        } finally {
View Full Code Here

    SimpleDateFormat format = new SimpleDateFormat("ddMMMyyyyHHmm");
    format.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    try {
      Date d = format.parse(dateS+timeS);
      VariableDS time = new VariableDS(ds, vhrr, null, "time", DataType.LONG, "",
          "seconds since 1970-01-01 00:00", "time generated from PRODUCT_METADATA/PRODUCT_DETAILS");

      time.addAttribute( new Attribute(_Coordinate.AxisType, AxisType.Time.toString())); // // LOOK : cant handle scalar coordinates yet ??
      time.addAttribute( new Attribute("IsoDate", new DateFormatter().toDateTimeStringISO(d)));
      ds.addVariable(vhrr, time);
      ArrayLong.D0 timeData = new ArrayLong.D0();
      timeData.set(d.getTime() / 1000);
      time.setCachedData(timeData, true);

    } catch (ParseException e) {
      e.printStackTrace();
      throw new IOException(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of ucar.nc2.dataset.CoordinateAxis$AxisComparator

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.