Examples of GridCoordSystem


Examples of ucar.nc2.dt.GridCoordSystem

  public void testSubset() throws Exception {
    ucar.nc2.dt.grid.GridDataset dataset = GridDataset.open(TestGrid.topDir+"rankTest.nc");

    GeoGrid grid = dataset.findGridByName("full4");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    doRead4(grid);

    GeoGrid grid_section = grid.subset(null, new Range(0,3,2), null, null);
    GridCoordSystem gcs_section = grid_section.getCoordinateSystem();
    CoordinateAxis zaxis = gcs_section.getVerticalAxis();
    assert zaxis.getSize() == 2;

    assert gcs_section.getXHorizAxis().equals( gcs.getXHorizAxis());
    assert gcs_section.getYHorizAxis().equals( gcs.getYHorizAxis());
    assert gcs_section.getTimeAxis().equals( gcs.getTimeAxis());

    Array data = grid_section.readDataSlice(-1, -1, -1, -1);
    NCdump.printArray( data, "grid_section", System.out,  null);

    dataset.close();
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

  public void utestAxisId() throws IOException {
    ucar.nc2.dt.grid.GridDataset dataset = GridDataset.open("C:/data/20100314_v_000000_l_0118800.nc");

    GeoGrid grid = dataset.findGridByName("wind_speed");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 3;

    CoordinateAxis axis = gcs.getXHorizAxis();
    assert axis != null;
    assert axis.getShortName().equals("x") : axis.getShortName();

    axis = gcs.getYHorizAxis();
    assert axis != null;
    assert axis.getShortName().equals("y") : axis.getShortName();

    dataset.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

  public void testRegular() throws Exception {
    ucar.nc2.dt.grid.GridDataset dataset = GridDataset.open(TestAll.cdmUnitTestDir + "conventions/nuwg/03061219_ruc.nc");

    GeoGrid grid = dataset.findGridByName("T");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    CoordinateAxis zaxis = gcs.getVerticalAxis();
    assert zaxis.getUnitsString().equals("hectopascals");

    GeoGrid grid_section = grid.subset(null, null, null, 3, 3, 3);

    GridCoordSystem gcs_section = grid_section.getCoordinateSystem();
    CoordinateAxis zaxis2 = gcs_section.getVerticalAxis();
    assert zaxis2.getSize() == 7;
    assert zaxis2.getUnitsString().equals("hectopascals");
    assert gcs_section.getTimeAxis().equals(gcs.getTimeAxis());

    Array data = grid_section.readDataSlice(-1, -1, -1, -1);
    assert data.getShape()[0] == 2 : data.getShape()[0];
    assert data.getShape()[1] == 7 : data.getShape()[1];
    assert data.getShape()[2] == 22 : data.getShape()[2];
    assert data.getShape()[3] == 31 : data.getShape()[3];

    // check axes
    for (CoordinateAxis axis : gcs_section.getCoordinateAxes()) {
      assert axis.getAxisType() != null;
    }

    // NCdump.printArray( data, "grid_section", System.out,  null);
    dataset.close();
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

  public void testGrib() throws Exception {
    GridDataset dataset = GridDataset.open(TestAll.cdmUnitTestDir + "formats/grib1/AVN.wmo");

    GeoGrid grid = dataset.findGridByName("Temperature");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    GeoGrid grid_section = grid.subset(null, null, null, 3, 3, 3);
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

  public void testWRF() throws Exception {
    GridDataset dataset = GridDataset.open(TestAll.cdmUnitTestDir + "conventions/wrf/wrfout_v2_Lambert.nc");

    GeoGrid grid = dataset.findGridByName("T");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    CoordinateAxis zaxis = gcs.getVerticalAxis();
    assert zaxis.getSize() == 27;

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

    GeoGrid grid_section = grid.subset(null, null, null, 3, 3, 3);

    Array data = grid_section.readDataSlice(-1, -1, -1, -1);
    assert data.getShape()[0] == 13 : data.getShape()[0];
    assert data.getShape()[1] == 9 : data.getShape()[1];
    assert data.getShape()[2] == 20 : data.getShape()[2];
    assert data.getShape()[3] == 25 : data.getShape()[3];

    GridCoordSystem gcs_section = grid_section.getCoordinateSystem();
    CoordinateAxis zaxis2 = gcs_section.getVerticalAxis();
    assert zaxis2.getSize() == 9 : zaxis2.getSize();

    assert zaxis2.getUnitsString().equals(zaxis.getUnitsString());
    assert gcs_section.getTimeAxis().equals(gcs.getTimeAxis());

    VerticalTransform vt_section = gcs_section.getVerticalTransform();
    assert vt_section != null;
    assert vt_section.getUnitString().equals(vt.getUnitString());

    dataset.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

    GridDataset dataset = GridDataset.open(filename);
    System.out.printf("open %s%n", filename);

    GeoGrid grid = dataset.findGridByName("Pixel_scene_type");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 3;

    // bbox =  ll: 16.79S 20.5W+ ur: 14.1N 20.09E
    LatLonRect bbox = new LatLonRect(new LatLonPointImpl(-16.79, -20.5), new LatLonPointImpl(14.1, 20.9));

    ProjectionImpl p = gcs.getProjection();
    ProjectionRect prect = p.latLonToProjBB(bbox); // must override default implementation
    System.out.printf("%s -> %s %n", bbox, prect);
    assert TestAll.closeEnough(prect.getMinX(), -2120.3375);
    assert TestAll.closeEnough(prect.getWidth(), 4279.2196);
    assert TestAll.closeEnough(prect.getMinY(), -1809.0359);
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

    GridDataset dataset = (GridDataset) result.featureDataset;

    GeoGrid grid = dataset.findGridByName("Temperature");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    GeoGrid grid_section = grid.subset(null, null, null, 3, 3, 3);
    int[] shape = grid_section.getShape();
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

    assert result.featureDataset != null;
    GridDataset dataset = (GridDataset) result.featureDataset;

    GeoGrid grid = dataset.findGridByName("PT");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    GeoGrid grid_section = grid.subset(null, null, null, 5, 5, 5);
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

  public void test2D() throws Exception {
    GridDataset dataset = GridDataset.open(TestAll.cdmUnitTestDir + "conventions/cf/mississippi.nc");

    GeoGrid grid = dataset.findGridByName("salt");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    GeoGrid grid_section = grid.subset(null, null, null, 5, 5, 5);

    Array data = grid_section.readDataSlice(-1, -1, -1, -1);
    assert data.getShape()[0] == 1 : data.getShape()[0];
    assert data.getShape()[1] == 4 : data.getShape()[1];
    assert data.getShape()[2] == 13 : data.getShape()[2];
    assert data.getShape()[3] == 26 : data.getShape()[3];

    grid_section = grid.subset(null, new Range(0, 0), null, 0, 2, 2);
    data = grid_section.readDataSlice(-1, -1, -1, -1);
    assert data.getShape()[0] == 1 : data.getShape()[0];
    assert data.getShape()[1] == 1 : data.getShape()[1];
    assert data.getShape()[2] == 32 : data.getShape()[2];
    assert data.getShape()[3] == 64 : data.getShape()[3];

    NCdump.printArray(data, "grid_section", System.out, null);

    LatLonPoint p0 = new LatLonPointImpl(29.0, -90.0);
    LatLonRect bbox = new LatLonRect(p0, 1.0, 2.0);
    grid_section = grid.subset(null, null, bbox, 1, 1, 1);
    data = grid_section.readDataSlice(-1, -1, -1, -1);

    assert data.getShape()[0] == 1 : data.getShape()[0];
    assert data.getShape()[1] == 20 : data.getShape()[1];
    assert data.getShape()[2] == 63 : data.getShape()[2];
    assert data.getShape()[3] == 53 : data.getShape()[3];

    gcs = grid_section.getCoordinateSystem();
    ProjectionRect rect = gcs.getBoundingBox();
    System.out.println(" rect= " + rect);

    p0 = new LatLonPointImpl(30.0, -90.0);
    bbox = new LatLonRect(p0, 1.0, 2.0);
    grid_section = grid.subset(null, null, bbox, 1, 1, 1);
    data = grid_section.readDataSlice(-1, -1, -1, -1);

    assert data.getShape()[0] == 1 : data.getShape()[0];
    assert data.getShape()[1] == 20 : data.getShape()[1];
    assert data.getShape()[2] == 18 : data.getShape()[2];
    assert data.getShape()[3] == 17 : data.getShape()[3];

    gcs = grid_section.getCoordinateSystem();
    System.out.println(" rect= " + gcs.getBoundingBox());


    dataset.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.GridCoordSystem

    // GridDataset dataset = GridDataset.open("dods://motherlode.ucar.edu:8080/thredds/dodsC/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km_best.ncd");
    GridDataset dataset = GridDataset.open("dods://motherlode.ucar.edu:8080/thredds/dodsC/fmrc/NCEP/NAM/CONUS_12km/NCEP-NAM-CONUS_12km-noaaport_best.ncd");

    GeoGrid grid = dataset.findGridByName("Relative_humidity");
    assert null != grid;
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert null != gcs;
    assert grid.getRank() == 4;

    GeoGrid grid_section = grid.subset(null, null, null, 1, 10, 10);
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.