Package ucar.nc2.dataset

Examples of ucar.nc2.dataset.NetcdfDataset


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


      }

      return result;
    }

    NetcdfDataset ncd = openDataset(invDataset, true, task, result.errLog);
    if (null != ncd)
      result.featureDataset = FeatureDatasetFactoryManager.wrap(result.featureType, ncd, task, result.errLog);

    if (null == result.featureDataset)
      result.fatalError = true;
View Full Code Here

      result.featureDataset = CdmrFeatureDataset.factory(wantFeatureType, access.getStandardUrlName());

    } else {

      // all other datatypes
      NetcdfDataset ncd = openDataset(access, true, task, result);
      if (null != ncd) {
        result.featureDataset = FeatureDatasetFactoryManager.wrap(result.featureType, ncd, task, result.errLog);
      }
    }
View Full Code Here

   * @return NetcdfDataset or null if failure
   * @throws IOException on read error
   */
  public NetcdfDataset openDataset(InvDataset invDataset, boolean acquire, ucar.nc2.util.CancelTask task, Formatter log) throws IOException {
    Result result = new Result();
    NetcdfDataset ncd = openDataset(invDataset, acquire, task, result);
    if (log != null) log.format("%s", result.errLog);
    return (result.fatalError) ? null : ncd;
  }
View Full Code Here

        accessList = new ArrayList<InvAccess>(rds.getAccess());
        continue;
      }

      // ready to open it through netcdf API
      NetcdfDataset ds;

// try to open
      try {
        ds = openDataset(access, acquire, task, result);
View Full Code Here

   * @return NetcdfDataset or null if failure
   * @throws IOException on read error
   */
  public NetcdfDataset openDataset(InvAccess access, boolean acquire, ucar.nc2.util.CancelTask task, Formatter log) throws IOException {
    Result result = new Result();
    NetcdfDataset ncd = openDataset(access, acquire, task, result);
    if (log != null) log.format("%s", result.errLog);
    return (result.fatalError) ? null : ncd;
  }
View Full Code Here

      if (rds == null) return null;
      return openDataset(rds, acquire, task, result);
    }

    // ready to open it through netcdf API
    NetcdfDataset ds;

    // open DODS type
    if ((serviceType == ServiceType.OPENDAP) || (serviceType == ServiceType.DODS)) {
      String curl = DODSNetcdfFile.canonicalURL(datasetLocation);
      ds = acquire ? NetcdfDataset.acquireDataset(curl, enhanceMode, task) : NetcdfDataset.openDataset(curl, enhanceMode, task);
    }

    // open CdmRemote
    else if (serviceType == ServiceType.CdmRemote) {
      String curl = CdmRemote.canonicalURL(datasetLocation);
      ds = acquire ? NetcdfDataset.acquireDataset(curl, enhanceMode, task) : NetcdfDataset.openDataset(curl, enhanceMode, task);
    }

    /* open ADDE type
   else if (serviceType == ServiceType.ADDE) {
     try {
       ds = ucar.nc2.adde.AddeDatasetFactory.openDataset(access, task);

     } catch (IOException e) {
       log.append("Cant open as ADDE dataset= "+datasetLocation);
       accessList.remove( access);
       continue;
     }
   } */

    else {
      // open through NetcdfDataset API
      ds = acquire ? NetcdfDataset.acquireDataset(datasetLocation, enhanceMode, task) : NetcdfDataset.openDataset(datasetLocation, enhanceMode, task);
    }

    if (ds != null) {
      ds.setId(datasetId);
      ds.setTitle(title);
      annotate(invDataset, ds);
    }

    // see if there's metadata LOOK whats this
    List list = invDataset.getMetadata(MetadataType.NcML);
View Full Code Here

    assert str.equals("http://www.opendap.org") || str.equals("http://www.dods.org") : str;
  }

  public void testDODSwithDataset() throws IOException {
    DODSNetcdfFile dodsfile = TestDODSRead.open("test.04");
    NetcdfDataset ds = new  NetcdfDataset( dodsfile, false);

    // bug in forming dods name
    Variable v = null;
    assert null != (v = ds.findVariable("types.b"));
    v.invalidateCache();
    v.read();
  }
View Full Code Here

    System.out.println("--Compare "+localPath+" to "+dodsUrl);
    compareDatasets(dodsUrl, localPath);
  }

  private void compareDatasets(String dodsUrl, String ncfile) throws IOException {
    NetcdfDataset org_ncfile = NetcdfDataset.openDataset(ncfile);
    NetcdfDataset dods_file = NetcdfDataset.openDataset(dodsUrl);
    compareDatasets( org_ncfile, dods_file);
  }
View Full Code Here

  }

  public void testBzipProblem() throws IOException, InvalidRangeException {
    // file where there was an error unzipping the file
    String filename = TestAll.cdmUnitTestDir + "formats/nexrad/level2/Level2_KFTG_20060818_1814.ar2v.uncompress.missingradials";
    NetcdfDataset ncd = NetcdfDataset.openDataset( filename);

    VariableDS azi = (VariableDS) ncd.findVariable("azimuthR");
    assert azi != null;
    VariableDS elev = (VariableDS) ncd.findVariable("elevationR");
    assert elev != null;
    VariableDS time = (VariableDS) ncd.findVariable("timeR");
    assert time != null;
    VariableDS r = (VariableDS) ncd.findVariable("Reflectivity");
    assert r != null;
    checkMissingValues(elev, azi, time, r);

    azi = (VariableDS) ncd.findVariable("azimuthV");
    assert azi != null;
    elev = (VariableDS) ncd.findVariable("elevationV");
    assert elev != null;
    time = (VariableDS) ncd.findVariable("timeV");
    assert time != null;
    r = (VariableDS) ncd.findVariable("RadialVelocity");
    assert r != null;
    checkMissingValues(elev, azi, time, r);

    r = (VariableDS) ncd.findVariable("SpectrumWidth");
    assert r != null;
    checkMissingValues(elev, azi, time, r);
  }
View Full Code Here

TOP

Related Classes of ucar.nc2.dataset.NetcdfDataset

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.