Package ucar.nc2.dt

Examples of ucar.nc2.dt.GridDatatype


                               LatLonRect llr) throws IOException {

        double           scaler;
        GridDataset      dataset =
            ucar.nc2.dt.grid.GridDataset.open(fileName);
        GridDatatype     grid    = dataset.findGridDatatype(gridName);
        GridCoordSystem  gcs     = grid.getCoordinateSystem();
        ProjectionImpl   proj    = grid.getProjection();

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

        // read in data
        Array    data      = grid.readDataSlice(time, level, -1, -1);
        Array    lon       = xaxis.read();
        Array    lat       = yaxis.read();

        double[] swathInfo = getSwathLatLonInformation(lat, lon);
View Full Code Here


  }

  public void testOceanS() throws java.io.IOException, InvalidRangeException {
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open(TestAll.cdmUnitTestDir + "transforms/roms_ocean_s_coordinate.nc");

    GridDatatype grid = gds.findGridDatatype("temp");
    assert grid != null;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalCT vct = gcs.getVerticalCT();
    assert vct != null;
    assert vct.getVerticalTransformType() == VerticalCT.Type.OceanS;
View Full Code Here

  }

  public void testOceanSigma() throws java.io.IOException, InvalidRangeException {
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open( TestAll.cdmUnitTestDir + "conventions/cf/gomoos_cf.nc");

    GridDatatype grid = gds.findGridDatatype("temp");
    assert grid != null;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalCT vct = gcs.getVerticalCT();
    assert vct != null;
    assert vct.getVerticalTransformType() == VerticalCT.Type.OceanSigma;
View Full Code Here

  }

  public void testAtmSigma() throws java.io.IOException, InvalidRangeException {
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open( TestAll.cdmUnitTestDir + "transforms/temperature.nc");

    GridDatatype grid = gds.findGridDatatype("Temperature");
    assert grid != null;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalCT vct = gcs.getVerticalCT();
    assert vct != null;
    assert vct.getVerticalTransformType() == VerticalCT.Type.Sigma;
View Full Code Here

  }

  public void testAtmHybrid() throws java.io.IOException, InvalidRangeException {
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open( TestAll.cdmUnitTestDir + "conventions/cf/ccsm2.nc");

    GridDatatype grid = gds.findGridDatatype("T");
    assert grid != null;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalCT vct = gcs.getVerticalCT();
    assert vct != null;
    assert vct.getVerticalTransformType() == VerticalCT.Type.HybridSigmaPressure : vct.getVerticalTransformType();
View Full Code Here

  }

  public void testWrfEta() throws java.io.IOException, InvalidRangeException {
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open( TestAll.cdmUnitTestDir + "conventions/wrf/wrfout_v2_Lambert.nc");

    GridDatatype grid = gds.findGridDatatype("T");
    assert grid != null;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalCT vct = gcs.getVerticalCT();
    assert vct != null;
    assert vct.getVerticalTransformType() == VerticalCT.Type.WRFEta : vct.getVerticalTransformType();
View Full Code Here

  public void utestStride() throws java.io.IOException, InvalidRangeException {
    String url= "dods://lead4.unidata.ucar.edu:8080/thredds/dodsC/model/UCAR/UNIDATA/WRF/STEERED/wrfout_d01_2006-04-20_00_00_00.nc";
    GridDataset gds = ucar.nc2.dt.grid.GridDataset.open( url);

    GridDatatype grid = gds.findGridDatatype("T");
    assert grid != null;

    grid = grid.makeSubset(null,null,null,1,2,4);

    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert gcs != null;

    VerticalTransform vt = gcs.getVerticalTransform();
    assert vt != null;
View Full Code Here

        if ( log.isDebugEnabled() )
          log.debug( "writeCoverageDataToFile(): tifFile=" + tifFile.getPath() );

        try
        {
          GridDatatype subset = this.coverage.makeSubset( tRange, zRange, bboxLatLonRect, 1, 1, 1 );
          Array data = subset.readDataSlice( 0, 0, -1, -1 );

          GeotiffWriter writer = new GeotiffWriter( tifFile.getPath() );
          writer.writeGrid( this.dataset.getDataset(), subset, data, format == Request.Format.GeoTIFF );

          writer.close();
View Full Code Here

    /*   tRange: 31:31
     zRange: 0:0
    yRange: 1:559
    zRange: 1:399 */
    GridDatatype subset = grid.makeSubset(null, null, new Range(31, 31), new Range(0, 0), new Range(1, 559), new Range(1, 399));
    assert subset != null;
    GridCoordSystem gcs2 = subset.getCoordinateSystem();
    assert null != gcs2;

    System.out.println("result lat/lon bbox= " + gcs2.getLatLonBoundingBox());
    System.out.println("result bbox= " + gcs2.getBoundingBox());

    Array data = subset.readVolumeData(0);
    int[] shape = data.getShape();
    assert shape.length == 3;
    assert shape[0] == 1;
    assert shape[1] == 559;
    assert shape[2] == 399;
View Full Code Here

  public void utestSubsetCoordEdges() throws Exception {
    NetcdfDataset fooDataset = NetcdfDataset.openDataset(TestAll.cdmLocalTestDataDir + "dataset/subsetCoordEdges.ncml");

    try {
      GridDataset fooGridDataset = new GridDataset(fooDataset);
      GridDatatype fooGrid = fooGridDataset.findGridDatatype("foo");

      CoordinateAxis1D fooTimeAxis = fooGrid.getCoordinateSystem().getTimeAxis1D();
      CoordinateAxis1D fooLatAxis = (CoordinateAxis1D) fooGrid.getCoordinateSystem().getYHorizAxis();
      CoordinateAxis1D fooLonAxis = (CoordinateAxis1D) fooGrid.getCoordinateSystem().getXHorizAxis();

      // Expected: [0.0, 31.0, 59.0, 90.0, 120.0]
      // Actual:   [0.0, 31.0, 59.0, 90.0, 120.0]
      System.out.println("mid time= " + Arrays.toString(fooTimeAxis.getCoordValues()));
      System.out.println("edge time= " + Arrays.toString(fooTimeAxis.getCoordEdges()));
      System.out.println();

      // Expected: [-90.0, -18.0, 36.0, 72.0, 90.0]
      // Actual:   [-90.0, -18.0, 36.0, 72.0, 90.0]
      System.out.println("mid lat= " + Arrays.toString(fooLatAxis.getCoordValues()));
      System.out.println("edge lat= " + Arrays.toString(fooLatAxis.getCoordEdges()));
      System.out.println();

      // Expected: [0.0, 36.0, 108.0, 216.0, 360.0]
      // Actual:   [0.0, 36.0, 108.0, 216.0, 360.0]
      System.out.println("mid lon= " + Arrays.toString(fooLonAxis.getCoordValues()));
      System.out.println("edge lon= " + Arrays.toString(fooLonAxis.getCoordEdges()));
      System.out.println();


      Range middleRange = new Range(1, 2);
      GridDatatype fooSubGrid = fooGrid.makeSubset(null, null, middleRange, null, middleRange, middleRange);

      CoordinateAxis1D fooSubTimeAxis = fooSubGrid.getCoordinateSystem().getTimeAxis1D();
      CoordinateAxis1D fooSubLatAxis = (CoordinateAxis1D) fooSubGrid.getCoordinateSystem().getYHorizAxis();
      CoordinateAxis1D fooSubLonAxis = (CoordinateAxis1D) fooSubGrid.getCoordinateSystem().getXHorizAxis();

      // Expected: [31.0, 59.0, 90.0]
      // Actual:   [30.25, 59.75, 89.25]
      System.out.println("mid time= " + Arrays.toString(fooSubTimeAxis.getCoordValues()));
      System.out.println("edge time= " + Arrays.toString(fooSubTimeAxis.getCoordEdges()));
View Full Code Here

TOP

Related Classes of ucar.nc2.dt.GridDatatype

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.