Package ucar.nc2

Examples of ucar.nc2.Group.findVariable()


  {
    int[] origin = new int[] { j, i};
    int[] shape = new int[] {1,1};

    NetcdfFile ncf = NetcdfFile.open( datasetLocation);
    Variable latVar = ncf.findVariable( "lat" );
    Array latArray = latVar.read( origin, shape );
    Variable lonVar = ncf.findVariable( "lon" );
    Array lonArray = lonVar.read( origin, shape );

    double latVal = latArray.getDouble( latArray.getIndex());
View Full Code Here


    int[] shape = new int[] {1,1};

    NetcdfFile ncf = NetcdfFile.open( datasetLocation);
    Variable latVar = ncf.findVariable( "lat" );
    Array latArray = latVar.read( origin, shape );
    Variable lonVar = ncf.findVariable( "lon" );
    Array lonArray = lonVar.read( origin, shape );

    double latVal = latArray.getDouble( latArray.getIndex());
    double lonVal = lonArray.getDouble( lonArray.getIndex());
View Full Code Here

    data.setString(helloGreek);
    ncfile.write(helloGreek, data);
    ncfile.close();

    NetcdfFile nc = NetcdfFile.open(filename);
    Variable v = ncfile.findVariable(helloGreek);
    assert v != null;
    assert v.getShortName().equals(helloGreek);

    Attribute att = v.findAttribute("units");
    assert att != null;
View Full Code Here

    Array data = v2.read();
    assert data.getElementType() == int.class;

    NetcdfDataset ncd = TestH5.openH5dataset("support/enum.h5");
    v2 = ncd.findVariable("enum");
    assert v2 != null;

    data = v2.read();
    assert data.getElementType() == String.class;
    ncfile.close();
View Full Code Here

    Array data = v2.read();
    assert data.getElementType() == byte.class;

    NetcdfDataset ncd = NetcdfDataset.openDataset("D:/netcdf4/tst_enum_data.nc");
    v2 = ncd.findVariable("primary_cloud");
    assert v2 != null;

    data = v2.read();
    assert data.getElementType() == String.class;
    ncfile.close();
View Full Code Here

    //H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
    NetcdfDataset ncfile = NetcdfDataset.openDataset(TestH5.testDir + "complex/compound_complex.h5");

    Variable dset = null;
    assert (null != (dset = ncfile.findVariable("CompoundComplex")));
    assert (dset.getDataType() == DataType.STRUCTURE);
    assert (dset.getRank() == 1);
    assert (dset.getSize() == 6);

    Dimension d = dset.getDimension(0);
View Full Code Here

  }

  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

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

    // 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,
View Full Code Here

    }

    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);
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.