Examples of NetcdfDataset


Examples of ucar.nc2.dataset.NetcdfDataset

    <scan location="file:src/test/data/ncml/nc/" suffix="mean.nc"/>
  </aggregation>
  */
  public void testScan() throws IOException {
    String filename = "file:./" + TestNcML.topDir + "aggUnionScan.xml";
    NetcdfDataset scanFile = NetcdfDataset.openDataset(filename, false, null);
    CompareNetcdf.compareFiles(ncfile, scanFile, true, true, false);
    scanFile.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

    scanFile.close();
  }

  public void testRename() throws IOException {
    String filename = "file:./" + TestNcML.topDir + "aggUnionRename.xml";
    NetcdfDataset scanFile = NetcdfDataset.openDataset(filename, false, null);
    Variable v = scanFile.findVariable("LavaFlow");
    assert v != null;
    scanFile.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

  public void testAggExisting() throws IOException {
    String filename = "file:"+TestAll.cdmUnitTestDir + "ncml/remote.ncml";

    System.out.println(" testAggExisting.try "+ filename);
    NetcdfDataset ncd = NetcdfDataset.openDataset(filename);
    System.out.println(" testAggExisting.open "+ ncd);

    Variable sst_time = ncd.findVariable("sst_time");
    assert sst_time != null;
    assert sst_time.getRank() == 2;
    int[] shape =  sst_time.getShape();
    assert shape[0] == 6;
    assert shape[1] == 1;

    ncd.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

  }

  public static void main(String args[]) throws IOException {
    //String filename = "C:/data/199707010200.CHRTOUT_DOMAIN2";
    String filename = "C:/data/199707010000.LAKEOUT_DOMAIN2";
    NetcdfDataset ncds = new NetcdfDataset();
    UnidataStationObsDataset ods = new UnidataStationObsDataset(ncds.openDataset(filename));
    StringBuffer sbuff = new StringBuffer(50 * 1000);
    ods.checkLinks(sbuff);
    System.out.println("\n\n" + sbuff.toString());
    ncds.shutdown();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

      return ucar.nc2.thredds.DqcStationObsDataset.factory( null, dqc);
    } */

    // otherwise open as netcdf and have a look. use NetcdfDataset in order to deal with scale/enhance, etc.
    NetcdfDataset ncfile = NetcdfDataset.acquireDataset( location, task);

    // add record variable if there is one.
    ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    if (UnidataStationObsDataset.isValidFile( ncfile))
      return new UnidataStationObsDataset( ncfile);

    if (UnidataPointObsDataset.isValidFile( ncfile))
      return new UnidataPointObsDataset( ncfile);

    if (DapperDataset.isValidFile( ncfile))
      return DapperDataset.factory( ncfile);

    if (SequenceObsDataset.isValidFile( ncfile))
      return new SequenceObsDataset( ncfile, task);

    if (UnidataStationObsDataset2.isValidFile( ncfile))
      return new UnidataStationObsDataset2( ncfile);

    if (NdbcDataset.isValidFile( ncfile))
      return new NdbcDataset( ncfile);

    if (MadisStationObsDataset.isValidFile( ncfile))
      return new MadisStationObsDataset( ncfile);

    if (OldUnidataStationObsDataset.isValidFile(ncfile))
      return new OldUnidataStationObsDataset( ncfile);

    // put at end to minimize false positive
    if (OldUnidataPointObsDataset.isValidFile( ncfile))
       return new OldUnidataPointObsDataset( ncfile);

    if (null != log) log.append("Cant find a Point/Station adapter for ").append(location);
    ncfile.close();
    return null;
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset


  public static void main(String args[]) throws IOException {
    //String url = "http://dapper.pmel.noaa.gov/dapper/epic/puget_prof_ctd.cdp";
    String url = "http://dapper.pmel.noaa.gov/dapper/epic/woce_sl_time_monthly.cdp";
    NetcdfDataset ncd = NetcdfDataset.openDataset( url);
    DapperDataset.factory(ncd);
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset


  private void convertAsNcdataset(String location, boolean useRecords) throws IOException {
    location = StringUtil.replace(location, '\\', "/");

    NetcdfDataset org_ncd = NetcdfDataset.openDataset(location, false, null);
    if (useRecords)
      org_ncd.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    NcMLWriter writer = new NcMLWriter();
    if (showFiles) {
      System.out.println("-----------");
      System.out.println("DS input filename= "+location);
    }

    // create a file and write it out
    int pos = location.lastIndexOf("/");
    String filename = location.substring(pos+1);
    String ncmlOut = TestDataset.writeDir+filename+ ".ncml";
    if (showFiles) System.out.println(" output filename= "+ncmlOut);
    try {
      OutputStream out = new BufferedOutputStream( new FileOutputStream( ncmlOut, false));
      writer.writeXML( org_ncd, out, null);
      out.close();
    } catch (IOException ioe) {
      ioe.printStackTrace();
      assert false;
    }

    // read it back in
    NetcdfDataset new_ncd = NetcdfDataset.openDataset(ncmlOut, false, null);
    if (useRecords)
      new_ncd.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    CompareNetcdf.compareFiles( org_ncd, new_ncd);
    //assert cat.equals( catV1);

    org_ncd.close();
    new_ncd.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

  }

  static void doit(PointDatasetStandardFactory fac, String filename) throws IOException {
    System.out.println(filename);
    Formatter errlog = new Formatter(System.out);
    NetcdfDataset ncd = ucar.nc2.dataset.NetcdfDataset.openDataset(filename);
    TableAnalyzer analysis = (TableAnalyzer) fac.isMine(FeatureType.ANY_POINT, ncd, errlog);

    fac.open(FeatureType.ANY_POINT, ncd, analysis, null, errlog);
    analysis.getDetailInfo(errlog);
    System.out.printf("\n-----------------");
    ncd.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

  public static void main(String args[]) throws Exception {
    long start = System.currentTimeMillis();
    Map<String, ucar.unidata.geoloc.Station> staHash = new HashMap<String,ucar.unidata.geoloc.Station>();

    String location = "R:/testdata/sounding/netcdf/Upperair_20070401_0000.nc";
    NetcdfDataset ncfile =  NetcdfDataset.openDataset(location);
    ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);

    // look through record varibles, for those that have "manLevel" dimension
    // make a StructureData object for those
    StructureMembers sm = new StructureMembers("manLevel");
    Dimension manDim = ncfile.findDimension("manLevel");
    Structure record = (Structure) ncfile.findVariable("record");
    List<Variable> allList = record.getVariables();
    List<VariableSimpleIF> varList = new ArrayList<VariableSimpleIF>();
    for (Variable v : allList) {
      if ((v.getRank() == 1) && v.getDimension(0).equals(manDim)) {
        // public VariableDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, DataType dataType,
        // String dims, String units, String desc) {
        varList.add( new VariableDS(ncfile, null, null, v.getShortName(), v.getDataType(), "", v.getUnitsString(), v.getDescription()));
        //(String name, String desc, String units, DataType dtype, int []shape)
        sm.addMember(v.getShortName(), v.getDescription(), v.getUnitsString(), v.getDataType() , new int[0]); // scalar
      }
    }

    ArrayStructureMA manAS = new ArrayStructureMA(sm, new int[] {manDim.getLength()} );

    // need the date units
    Variable time = ncfile.findVariable("synTime");
    String timeUnits  = ncfile.findAttValueIgnoreCase(time, "units", null);
    timeUnits = StringUtil.remove(timeUnits, '(')// crappy fsl'ism
    timeUnits = StringUtil.remove(timeUnits, ')');
    DateUnit timeUnit = new DateUnit(timeUnits);

    // extract stations
View Full Code Here

Examples of ucar.nc2.dataset.NetcdfDataset

    long start = System.currentTimeMillis();

    // do it in memory for speed
    NetcdfFile ncfile = inMemory ? NetcdfFile.openInMemory(fileIn) : NetcdfFile.open(fileIn);
    NetcdfDataset ncd = new NetcdfDataset(ncfile);

    StringBuilder errlog = new StringBuilder();
    StationObsDataset sobs = (StationObsDataset) TypedDatasetFactory.open(FeatureType.STATION, ncd, null, errlog);

    List<ucar.unidata.geoloc.Station> stns = sobs.getStations();
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.