/** * Open a netcdf dataset, using NetcdfDataset.defaultEnhanceMode plus CoordSystems * and turn into a GridDataset. * * @param location netcdf dataset to open, using NetcdfDataset.acquireDataset(). * @return GridDataset * @throws java.io.IOException on read error * @see ucar.nc2.dataset.NetcdfDataset#acquireDataset */ static public GridDataset open(String location) throws java.io.IOException { return open(location, NetcdfDataset.getDefaultEnhanceMode()); }
/** * Open a netcdf dataset, using NetcdfDataset.defaultEnhanceMode plus CoordSystems * and turn into a GridDataset. * * @param location netcdf dataset to open, using NetcdfDataset.acquireDataset(). * @return GridDataset * @throws java.io.IOException on read error * @see ucar.nc2.dataset.NetcdfDataset#acquireDataset */ static public GridDataset open(String location) throws java.io.IOException { return open(location, NetcdfDataset.getDefaultEnhanceMode()); }
/** * Open a netcdf dataset, using NetcdfDataset.defaultEnhanceMode plus CoordSystems * and turn into a GridDataset. * * @param location netcdf dataset to open, using NetcdfDataset.acquireDataset(). * @return GridDataset * @throws java.io.IOException on read error * @see ucar.nc2.dataset.NetcdfDataset#acquireDataset */ static public GridDataset open(String location) throws java.io.IOException { return open(location, NetcdfDataset.getDefaultEnhanceMode()); }
static public DtCoverageDataset open(DatasetUrl durl) throws java.io.IOException { return open(durl, NetcdfDataset.getDefaultEnhanceMode()); }
/** * Open a netcdf dataset, using NetcdfDataset.defaultEnhanceMode plus CoordSystems * and turn into a DtCoverageDataset. * * @param location netcdf dataset to open, using NetcdfDataset.acquireDataset(). * @return GridDataset * @throws java.io.IOException on read error * @see ucar.nc2.dataset.NetcdfDataset#acquireDataset */ static public DtCoverageDataset open(String location) throws java.io.IOException { DatasetUrl durl = DatasetUrl.findDatasetUrl(location); return open(durl, NetcdfDataset.getDefaultEnhanceMode()); }
/** * Create a GridDataset from a NetcdfDataset. * * @param ds underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ds, Formatter parseInfo) throws IOException { this.ds = ds; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ds.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ds.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids\n"); List<Variable> vars = ds.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ds, varDS, parseInfo); } }
/** * Create a GridDataset from a NetcdfDataset. * * @param ncd underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ncd, Formatter parseInfo) throws IOException { this.ncd = ncd; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ncd.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ncd.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids%n"); List<Variable> vars = ncd.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ncd, varDS, parseInfo); } }
/** * Create a GridDataset from a NetcdfDataset. * * @param ds underlying NetcdfDataset, will do Enhance.CoordSystems if not already done. * @param parseInfo put parse info here, may be null * @throws java.io.IOException on read error */ public GridDataset(NetcdfDataset ds, Formatter parseInfo) throws IOException { this.ds = ds; // ds.enhance(EnumSet.of(NetcdfDataset.Enhance.CoordSystems)); Set<Enhance> enhance = ds.getEnhanceMode(); if(enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ds.enhance(enhance); // look for geoGrids if (parseInfo != null) parseInfo.format("GridDataset look for GeoGrids%n"); List<Variable> vars = ds.getVariables(); for (Variable var : vars) { VariableEnhanced varDS = (VariableEnhanced) var; constructCoordinateSystems(ds, varDS, parseInfo); } }
if (enhance == null || enhance.isEmpty()) enhance = NetcdfDataset.getDefaultEnhanceMode(); ncd.enhance(enhance);
@Test public void testWrfNoTimeVar() throws IOException { String tstFile = TestDir.cdmLocalTestDataDir +"wrf/WrfNoTimeVar.nc"; logger.info("Open '{}'", tstFile); Set<NetcdfDataset.Enhance> defaultEnhanceMode = NetcdfDataset.getDefaultEnhanceMode(); EnumSet<NetcdfDataset.Enhance> enhanceMode = EnumSet.copyOf(defaultEnhanceMode); enhanceMode.add(NetcdfDataset.Enhance.IncompleteCoordSystems); DatasetUrl durl = DatasetUrl.findDatasetUrl (tstFile); NetcdfDataset ncd = NetcdfDataset.acquireDataset(durl, enhanceMode, null); List<CoordinateSystem> cs = ncd.getCoordinateSystems(); Assert.assertEquals(1, cs.size()); CoordinateSystem dsCs = cs.get(0); Assert.assertEquals(2, dsCs.getCoordinateAxes().size()); VariableDS var = (VariableDS) ncd.findVariable("T2"); List<CoordinateSystem> varCs = var.getCoordinateSystems(); Assert.assertEquals(1, varCs.size()); Assert.assertEquals(dsCs, varCs.get(0)); } }
enhance(NetcdfDataset.getDefaultEnhanceMode());
@Test public void openWithEnhance() throws Exception { try (NetcdfDataset ncDataset = NetcdfDataset.openDataset(filename, true, null)) { if (show) ncDataset.writeNcML(System.out, null); Assert.assertEquals(NetcdfDataset.getDefaultEnhanceMode(), ncDataset.getEnhanceMode()); Assert.assertTrue("size="+ncDataset.getCoordinateSystems().size(), ncDataset.getCoordinateSystems().size() > 0); } } }
enhance(NetcdfDataset.getDefaultEnhanceMode()); } else { this.scaleMissingProxy = new EnhanceScaleMissingImpl();
this.enhanceProxy = new EnhancementsImpl( this); if (enhance) { enhance(NetcdfDataset.getDefaultEnhanceMode()); } else { this.scaleMissingProxy = new EnhanceScaleMissingImpl();
public void testDatasetAddRecord() throws InvalidRangeException, IOException { String location = TestDir.cdmLocalTestDataDir + "testWriteRecord.nc"; DatasetUrl durl = new DatasetUrl(null, location); NetcdfDataset nc = NetcdfDataset.openDataset(durl, NetcdfDataset.getDefaultEnhanceMode(), -1, null, NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);