Examples of CoordinateAxis1D


Examples of ucar.nc2.dataset.CoordinateAxis1D

    // <CoverageOfferingBrief>/lonLatEnvelope/gml:pos
    String firstPosition = llpt.getLongitude() + " " + llpt.getLatitude();
    double lon = llpt.getLongitude() + llbb.getWidth();
    String secondPosition = lon + " " + urpt.getLatitude();
// ToDo WCS 1.0Plus - Deal with conversion to meters. (Yikes!!)
    CoordinateAxis1D vertAxis = gcs.getVerticalAxis();
    if ( vertAxis != null )
    {
      // See verAxis.getUnitsString()
      double zeroIndexValue = vertAxis.getCoordValue( 0 );
      double sizeIndexValue = vertAxis.getCoordValue( ( (int) vertAxis.getSize() ) - 1 );
      if ( vertAxis.getPositive().equals( ucar.nc2.constants.CF.POSITIVE_UP))
      {
        firstPosition += " " + zeroIndexValue;
        secondPosition += " " + sizeIndexValue;
      }
      else
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    fmrDef.readDefinitionXML(defName);

    // replace vert coords
    List<ForecastModelRunInventory.VertCoord> vcList = fmrInv.getVertCoords();
    for (ForecastModelRunInventory.VertCoord vc : vcList) {
      CoordinateAxis1D axis = vc.axis;
      if (axis == null)
        System.out.println("*** No Axis " + vc.getName());
      else {
        // boolean isLayer = null != axis.findAttribute(_Coordinate.ZisLayer);
        //if (isLayer) {
        if (showState) System.out.print(" " + vc.getName() + " contig= " + axis.isContiguous());
        // see if theres any TimeCoord that use this
        //findGridsForVertCoord( fmrDef, vc);
        boolean ok = fmrDef.replaceVertCoord(vc);
        if (showState) System.out.println(" = " + ok);
        //}
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    System.out.println(datasetName);
    ForecastModelRunInventory fmrInv = ForecastModelRunInventory.open(null, datasetName, ForecastModelRunInventory.OPEN_FORCE_NEW, true);
    List<ForecastModelRunInventory.VertCoord> vcList = fmrInv.getVertCoords();
    for (ForecastModelRunInventory.VertCoord vc : vcList) {
      CoordinateAxis1D axis = vc.axis;
      if (axis == null)
        System.out.println(" No Axis " + vc.getName());
      else {
        if (axis.isInterval()) {
          System.out.println(" Layer " + vc.getName() + " contig= " + axis.isContiguous());
          // see if theres any TimeCoord that use this
          findGridsForVertCoord(fmrDef, vc);
        }
      }
      boolean got = fmrDef.findVertCoordByName(vc.getName()) != null;
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

      VariableEnhanced ve = gg.getVariable();
      Variable v = ve.getOriginalVariable();   // LOOK why original variable ??
      addMissing(v, gcs, grid);

      // LOOK: Note this assumes a dense coordinate system
      CoordinateAxis1D axis = gcs.getTimeAxis1D();
      if (axis != null) {
        TimeCoord tc = getTimeCoordinate(axis);
        tc.vars.add(grid);
        grid.parent = tc;
      }

      CoordinateAxis1D eaxis = gcs.getEnsembleAxis();
      if (eaxis != null) {
        int[] einfo = getEnsInfov );
        grid.ec = getEnsCoordinate(eaxis, einfo );
      }

      CoordinateAxis1D vaxis = gcs.getVerticalAxis();
      if (vaxis != null) {
        grid.vc = getVertCoordinate(vaxis);
      }

      LatLonRect rect = gcs.getLatLonBoundingBox();
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    return p;
  }

  public boolean hasVert( GridDatatype grid, double zCoord) {
    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1D zAxis = gcs.getVerticalAxis();
    if (zAxis == null) return false;
    return (zAxis.findCoordElement( zCoord) >= 0);
  }
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    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);

    Array data  = grid.readDataSlice(tidx, zidx, xy[1], xy[0]);

    // use actual grid midpoint
    LatLonPoint latlon = gcs.getLatLon(xy[0], xy[1]);

    Point p = new Point();
    p.lat = latlon.getLatitude();
    p.lon = latlon.getLongitude();
    p.z = zAxis.getCoordValue( zidx);
    p.dataValue = data.getDouble( data.getIndex());
    return p;
  }
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

  private Element genRectifiedGridElem( WcsCoverage coverage )
  {
    // ../spatialDomain/gml:RectifiedGrid
    Element rectifiedGridElem = new Element( "RectifiedGrid", gmlNS);

    CoordinateAxis1D xaxis = (CoordinateAxis1D) coverage.getCoordinateSystem().getXHorizAxis();
    CoordinateAxis1D yaxis = (CoordinateAxis1D) coverage.getCoordinateSystem().getYHorizAxis();
    CoordinateAxis1D zaxis = coverage.getCoordinateSystem().getVerticalAxis();

    // ../spatialDomain/gml:RectifiedGrid@srsName [0..1] (URI)
    rectifiedGridElem.setAttribute( "srsName", coverage.getNativeCrs() );

    // ../spatialDomain/gml:RectifiedGrid@dimension [1] (positive integer)
    int ndim = ( zaxis != null ) ? 3 : 2;
    rectifiedGridElem.setAttribute( "dimension", Integer.toString( ndim ) );

    // ../spatialDomain/gml:RectifiedGrid/gml:limits [1]
    int[] minValues = new int[ndim];
    int[] maxValues = new int[ndim];

    maxValues[0] = (int) ( xaxis.getSize() - 1 );
    maxValues[1] = (int) ( yaxis.getSize() - 1 );
    if ( zaxis != null )
      maxValues[2] = (int) ( zaxis.getSize() - 1 );

    Element limitsElem =  new Element( "limits", gmlNS);

    // ../spatialDomain/gml:RectifiedGrid/gml:limits/gml:GridEnvelope [1]
    // ../spatialDomain/gml:RectifiedGrid/gml:limits/gml:GridEnvelope/gml:low [1] (integer list)
    // ../spatialDomain/gml:RectifiedGrid/gml:limits/gml:GridEnvelope/gml:high [1] (integer list)
    limitsElem.addContent(
            new Element( "GridEnvelope", gmlNS)
                    .addContent( new Element( "low", gmlNS ).addContent( genIntegerListString( minValues)))
                    .addContent( new Element( "high", gmlNS).addContent( genIntegerListString( maxValues))) );

    rectifiedGridElem.addContent( limitsElem);

    // ../spatialDomain/gml:RectifiedGrid/gml:axisName [1..*] (string)
    rectifiedGridElem.addContent( new Element( "axisName", gmlNS).addContent( "x"));
    rectifiedGridElem.addContent( new Element( "axisName", gmlNS).addContent( "y"));
    if ( zaxis != null )
      rectifiedGridElem.addContent( new Element( "axisName", gmlNS ).addContent( "z" ) );

    // ../spatialDomain/gml:RectifiedGrid/gml:origin [1]
    // ../spatialDomain/gml:RectifiedGrid/gml:origin/gml:pos [1] (space seperated list of double values)
    // ../spatialDomain/gml:RectifiedGrid/gml:origin/gml:pos@dimension [0..1]  (number of entries in list)
    double[] origin = new double[ndim];
    origin[0] = xaxis.getStart();
    origin[1] = yaxis.getStart();
    if ( zaxis != null )
      origin[2] = zaxis.getStart();

    rectifiedGridElem.addContent(
            new Element( "origin", gmlNS).addContent(
                    new Element( "pos", gmlNS).addContent( genDoubleListString( origin))));

    // ../spatialDomain/gml:RectifiedGrid/gml:offsetVector [1..*] (space seperated list of double values)
    // ../spatialDomain/gml:RectifiedGrid/gml:offsetVector@dimension [0..1]  (number of entries in list)
    double[] xoffset = new double[ndim];
    xoffset[0] = xaxis.getIncrement();
    rectifiedGridElem.addContent(
            new Element( "offsetVector", gmlNS)
                    .addContent( genDoubleListString( xoffset)));

    double[] yoffset = new double[ndim];
    yoffset[1] = yaxis.getIncrement();
    rectifiedGridElem.addContent(
            new Element( "offsetVector", gmlNS )
                    .addContent( genDoubleListString( yoffset ) ) );

    if ( zaxis != null )
    {
      double[] zoffset = new double[ndim];
      zoffset[2] = zaxis.getIncrement();
      rectifiedGridElem.addContent(
              new Element( "offsetVector", gmlNS )
                      .addContent( genDoubleListString( zoffset ) ) );
    }

View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    double lon = llpt.getLongitude() + llbb.getWidth();
    int posDim = 2;
    String firstPosition = llpt.getLongitude() + " " + llpt.getLatitude();
    String secondPosition = lon + " " + urpt.getLatitude();
    // ToDo WCS 1.0Plus - Deal with conversion to meters. (Yikes!!)
    CoordinateAxis1D vertAxis = gcs.getVerticalAxis();
    if ( vertAxis != null )
    {
      posDim++;
      // See verAxis.getUnitsString()
      double zeroIndexValue = vertAxis.getCoordValue( 0 );
      double sizeIndexValue = vertAxis.getCoordValue( ( (int) vertAxis.getSize() ) - 1 );
      if ( vertAxis.getPositive().equals( ucar.nc2.constants.CF.POSITIVE_UP ) )
      {
        firstPosition += " " + zeroIndexValue;
        secondPosition += " " + sizeIndexValue;
      }
      else
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

    if ( bbox != null && ( ! bbox.equals( "" ) ) )
    {
      String[] bboxSplit = splitBoundingBox( bbox);
      requestLatLonBBox = genRequestLatLonBoundingBox( bboxSplit, coverage.getCoordinateSystem());

      CoordinateAxis1D vertAxis = this.coverage.getCoordinateSystem().getVerticalAxis();
      if ( vertAxis != null )
        requestVertSubset = genRequestVertSubset( bboxSplit, vertAxis );
    }
    if ( time != null && ( ! time.equals( "" )) )
      timeRange = parseTime( time);
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis1D

        if ( !gcs.isRegularSpatial()) {
            throw new IllegalArgumentException(
                "Must have 1D x and y axes for " + grid.getFullName());
        }

        CoordinateAxis1D xaxis = (CoordinateAxis1D) gcs.getXHorizAxis();
        CoordinateAxis1D yaxis = (CoordinateAxis1D) gcs.getYHorizAxis();

        //latlon coord does not need to be scaled
        double scaler = (gcs.isLatLon())
                        ? 1.0
                        : 1000.0;

        // data must go from top to bottom LOOK IS THIS REALLY NEEDED ?
        double xStart = xaxis.getCoordValue(0) * scaler;
        double yStart = yaxis.getCoordValue(0) * scaler;
        double xInc   = xaxis.getIncrement() * scaler;
        double yInc   = Math.abs(yaxis.getIncrement()) * scaler;

        if (yaxis.getCoordValue(0) < yaxis.getCoordValue(1)) {
            data   = data.flip(0);
            yStart = yaxis.getCoordValue((int) yaxis.getSize() - 1) * scaler;
        }

        if (gcs.isLatLon()) {
            Array lon = xaxis.read();
            data   = geoShiftDataAtLon(data, lon);
            xStart = geoShiftGetXstart(lon, xInc);
            //xStart = -180.0;
        }

        if ( !xaxis.isRegular() || !yaxis.isRegular()) {
            throw new IllegalArgumentException(
                "Must be evenly spaced grid = " + grid.getFullName());
        }

        if (pageNumber > 1) {
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.