Java Code Examples for ucar.ma2.Index#incr()
The following examples show how to use
ucar.ma2.Index#incr() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestNcMLValues.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Before public void setUp() { ncml = "<?xml version='1.0' encoding='UTF-8'?>\n" + "<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'>\n" + " <dimension name='intDim' length='3' />\n" + " <variable name='singleWs' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Single White Space With Default Separator' />\n" + " <values>0 1 2</values>\n" + " </variable>\n" + " <variable name='multiWs' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Multi-length White Spaces With Default Separator' />\n" + " <values>0 1 2</values>\n" + " </variable>\n" + " <variable name='tabs' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Tab Spaces With Default Separator' />\n" + " <values>0\t1\t2</values>\n" + " </variable>\n" + " <variable name='mixedTabSpace' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Mixed Tab/Single-Space Spaces With Default Separator' />\n" + " <values>0\t1 2</values>\n" + " </variable>\n" + " <variable name='mixedTabSpaces' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Mixed Tab/Multi-Space Spaces With Default Separator' />\n" + " <values>0\t1 2</values>\n" + " </variable>\n" + " <variable name='mixedSpace' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Mixed Spaces With Default Separator' />\n" + " <values>0\t 1\t 2</values>\n" + " </variable>\n" + " <variable name='customSep' type='int' shape='intDim'>\n" + " <attribute name='description' value='Test Custom Separator' />\n" + " <values separator='-'>0-1-2</values>\n" + " </variable>\n" + "</netcdf>"; expectedIntLength = 3; expectedIntShape = new int[] {expectedIntLength}; expectedIntValues = new ArrayInt(expectedIntShape, false); intVarNames = new String[] {"singleWs", "multiWs", "tabs", "mixedTabSpace", "mixedTabSpaces", "mixedSpace", "customSep"}; Index idx = expectedIntValues.getIndex(); for (int i = 0; i < expectedIntLength; i++) { expectedIntValues.set(idx, i); idx.incr(); } try { ncfile = NcMLReader.readNcML(new StringReader(ncml), null); } catch (IOException e) { System.out.println("IO error = " + e); e.printStackTrace(); } }
Example 2
Source File: TestNcMLValues.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Before public void setUp() { ncml = "<?xml version='1.0' encoding='UTF-8'?>\n" // leavit + "<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'>\n" // leavit + " <dimension name='intDim' length='3' />\n" // leavit + " <variable name='singleWs' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Single White Space With Default Separator' />\n" // leavit + " <values>0 1 2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='multiWs' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Multi-length White Spaces With Default Separator' />\n" // leavit + " <values>0 1 2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='tabs' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Tab Spaces With Default Separator' />\n" // leavit + " <values>0\t1\t2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='mixedTabSpace' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Mixed Tab/Single-Space Spaces With Default Separator' />\n" // leavit + " <values>0\t1 2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='mixedTabSpaces' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Mixed Tab/Multi-Space Spaces With Default Separator' />\n" // leavit + " <values>0\t1 2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='mixedSpace' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Mixed Spaces With Default Separator' />\n" // leavit + " <values>0\t 1\t 2</values>\n" // leavit + " </variable>\n" // leavit + " <variable name='customSep' type='int' shape='intDim'>\n" // leavit + " <attribute name='description' value='Test Custom Separator' />\n" // leavit + " <values separator='-'>0-1-2</values>\n" // leavit + " </variable>\n" // leavit + "</netcdf>"; // leavit expectedIntLength = 3; expectedIntShape = new int[] {expectedIntLength}; expectedIntValues = new ArrayInt(expectedIntShape, false); intVarNames = new String[] {"singleWs", "multiWs", "tabs", "mixedTabSpace", "mixedTabSpaces", "mixedSpace", "customSep"}; Index idx = expectedIntValues.getIndex(); for (int i = 0; i < expectedIntLength; i++) { expectedIntValues.set(idx, i); idx.incr(); } try { ncfile = NcMLReaderNew.readNcML(new StringReader(ncml), null, null).build(); } catch (IOException e) { System.out.println("IO error = " + e); e.printStackTrace(); } }