Examples of GridDataset


Examples of ucar.nc2.dt.GridDataset

  // TestAll.upcShareDir + /testdata2/grid/netcdf/wrf/wrfout_v2_Lambert.nc

  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;

    ArrayDouble.D3 ca = vt.getCoordinateArray(0);
    assert ca != null;
    assert ca.getRank() == 3 : ca.getRank();

    int[] shape = ca.getShape();
    for (int i = 0; i < 3; i++)
      System.out.println(" shape " + i + " = " + shape[i]);

    assert shape[0] == 30;
    assert shape[1] == 143/2 + 1;
    assert shape[2] == 143/4 + 1;

    gds.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

  }

  public void testNcmlGrid() throws IOException {
    String filename = "file:" + TestAll.cdmUnitTestDir + "ncml/nc/seawifs/aggDirectory.ncml";

    GridDataset gds = GridDataset.open( filename);
    System.out.println(" TestNcmlAggExisting.openGrid "+ filename);

    List grids = gds.getGrids();
    assert grids.size() == 2;

    gds.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

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

View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

    //String defaultFilename = "R:/testdata2/motherlode/grid/NAM_Alaska_45km_conduit_20060801_0000.grib1";
    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);
View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

  // I really don't think this is a problem with your code
  // may be bug in HDF5 1.8.4-patch1
  public void utestTiling() throws IOException {
    // Global Heap 1t 13059 runs out with no heap id = 0
    String filename = testDir+"tiling.nc4";
    GridDataset gridDataset = GridDataset.open(filename);
    GridDatatype grid = gridDataset.findGridByName("Turbulence_SIGMET_AIRMET" );
    System.out.printf("grid=%s%n", grid);
    grid.readDataSlice( 4, 13, 176, 216 ); // FAILS
    gridDataset.close();
  }
View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

    ncfile.close();
  }

  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.GridDataset

    assert v.getDataType() == DataType.INT;
    assert v instanceof CoordinateAxis;
    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.GridDataset

    NetcdfDataset ds = NetcdfDataset.openDataset(location);
    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.GridDataset

    FeatureType ft = FeatureType.getType(fType);

    if (ft == null || ft == FeatureType.NONE || ft == FeatureType.GRID) {
      CdmRemote ncremote = new CdmRemote(uri);
      NetcdfDataset ncd = new NetcdfDataset(ncremote, null);
      return new GridDataset(ncd);

    } else {
      List<VariableSimpleIF> dataVars = FeatureDatasetPointXML.getDataVariables(doc);
      LatLonRect bb = FeatureDatasetPointXML.getSpatialExtent(doc);
      DateRange dr = FeatureDatasetPointXML.getTimeSpan(doc);
View Full Code Here

Examples of ucar.nc2.dt.grid.GridDataset

        }
      }
    }

    // generate it and save it
    GridDataset gds = null;
    try {
      if (ncml == null) {
        gds = GridDataset.open( mfile.getPath());

      } else {
        NetcdfFile nc = NetcdfDataset.acquireFile(mfile.getPath(), null);
        NetcdfDataset ncd = NcMLReader.mergeNcML(nc, ncml); // create new dataset
        ncd.enhance(); // now that the ncml is added, enhance "in place", ie modify the NetcdfDataset
        gds = new GridDataset(ncd);
      }

      // System.out.println("gds dataset= "+ gds.getNetcdfDataset());

      GridDatasetInv inv = new GridDatasetInv(gds, cm.extractRunDate(mfile));
      String xmlString = inv.writeXML( new Date(mfile.getLastModified()));
      cm.putMetadata(mfile, "fmrInv.xml", xmlString.getBytes("UTF-8"));
      if (log.isDebugEnabled()) log.debug(" added xmlFile "+ mfile.getPath()+".fmrInv.xml to cache");
      if (debug) System.out.printf(" added xmlFile %s.fmrInv.xml to cache%n", mfile.getPath());
      // System.out.println("new xmlBytes= "+ xmlString);
      return inv;
    } finally {
      if (gds != null) gds.close();
    }
  }
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.