Examples of GeoGrid


Examples of ucar.nc2.dt.grid.GeoGrid

public class ReadGrid {

  public static void read( String filename) throws IOException {

    GridDataset gds = GridDataset.open (filename);
    GeoGrid grid = gds.findGridByName("Temperature");

    long startTime = System.currentTimeMillis();

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

    long endTime = System.currentTimeMillis();
    long diff = endTime - startTime;
    System.out.println("read "+data.getSize()+"  took "+diff+ " msecs");
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

    String defaultFilename = "R:/testdata/grid/grib/grib2/test/NAM_CONUS_12km_20060305_1200.grib2";
    String filename = (arg.length > 0) ? arg[0] : defaultFilename;
    try {
      long start = System.currentTimeMillis();
      GridDataset gridDs = GridDataset.open (filename);
      GeoGrid gg = gridDs.findGridByName("Temperature");
      long took = System.currentTimeMillis() - start;
      System.out.println("open took = " + took+" msecs");

      start = System.currentTimeMillis();
      Array data = gg.readVolumeData(0);
      took = System.currentTimeMillis() - start;
      float size = (float) data.getSize() * gg.getDataType().getSize() / (1000 * 1000);
      System.out.println(size+" Mbytes, took = " + took+" msecs");

    } catch (Exception ioe) {
      ioe.printStackTrace();
    }
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

  }

  public void utestMargolis() throws IOException, InvalidRangeException {
    String dataDir = TestAll.cdmUnitTestDir + "nomads/gfs-hi/";
    GridDataset gridDataset = GridDataset.open( "D:/AStest/margolis/grib2ncdf.ncml" );
    GeoGrid grid = gridDataset.findGridByName( "Turbulence_SIGMET_AIRMET" );
    System.out.println("Grid= "+grid+" section="+ new Section(grid.getShape()));
    System.out.println(" coordSys= "+grid.getCoordinateSystem());

    GeoGrid subset = (GeoGrid) grid.makeSubset(new Range(0, 0), null, new Range(1,1), null, null, null);
    System.out.println("subset= "+subset+" section="+ new Section(subset.getShape()));
    System.out.println(" coordSys= "+subset.getCoordinateSystem());

    gridDataset.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

    CoordinateAxis axis = (CoordinateAxis) v;
    assert axis.getAxisType() == AxisType.Time;
   
    GridDataset gd = new GridDataset(ncd, null);

    GeoGrid grid = (GeoGrid) gd.findGridByName("rh");
    assert grid != null;
    assert grid.getDataType() == DataType.INT;
    System.out.printf("%s%n", ncd);

    ncfile.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

    ds.close();
  }

  public void testCF() throws IOException {
    GridDataset ds = GridDataset.open(TestAll.cdmUnitTestDir + "conventions/cf/twoGridMaps.nc");
    GeoGrid grid = ds.findGridByName("altitude");
    GridCoordSystem gcs = grid.getCoordinateSystem();
    assert 1 == gcs.getCoordinateTransforms().size();
    CoordinateTransform ct = gcs.getCoordinateTransforms().get(0);
    assert ct.getTransformType() == TransformType.Projection;
    assert ct.getName().equals("projection_stere");
    ds.close();
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

  public void testErie() throws IOException, InvalidRangeException {
    String uri = "C:\\data\\work\\signell/erie_test.ncml";
    String var = "temp";

    GridDataset ds = GridDataset.open(uri);
    GeoGrid grid = ds.findGridByName(var);
    Section s = new Section(grid.getShape());
    System.out.printf("var = %s %n", s);

    GridCoordSystem gcs = grid.getCoordinateSystem();
    VerticalTransform vt = gcs.getVerticalTransform();
    ArrayDouble.D3 z = vt.getCoordinateArray(0);
    Section sv = new Section(z.getShape());
    System.out.printf("3dcoord = %s %n", sv);
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

  }

  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.grid.GeoGrid

  }

  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();
View Full Code Here

Examples of ucar.nc2.dt.grid.GeoGrid

  private void testGrid(String uri, String var) throws IOException, InvalidRangeException {

    GridDataset ds = null;
    try {
      ds = GridDataset.open(uri);
      GeoGrid grid = ds.findGridByName(var);
      Section s = new Section(grid.getShape());
      System.out.printf("var = %s %n", s);

      GridCoordSystem GridCoordS = grid.getCoordinateSystem();
      VerticalTransform vt = GridCoordS.getVerticalTransform();
      ArrayDouble.D3 z = vt.getCoordinateArray(0);
      Section sv = new Section(z.getShape());
      System.out.printf("3dcoord = %s %n", sv);
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.