public Array getLongitude( Range range ) throws IOException, InvalidRangeException { List section = new ArrayList(1); section.add( range); return( lonVar.read( section)); }
public Array getLongitude( Range range ) throws IOException, InvalidRangeException { List section = new ArrayList(2); section.add( range); section.add( trajPointRange ); return( lonVar.read( section)); }
public float[] readAllData() throws IOException { Array allData; Sweep spn = (Sweep)sweeps.get(0); Variable v = spn.getsweepVar(); try { allData = v.read(); } catch (IOException e) { throw new IOException(e.getMessage()); } return (float []) allData.get1DJavaArray(float.class); }
public float[] getElevation() throws IOException { float[] spArray = null; try { Variable sp = ds.findVariable("elevation"); Array spData = sp.read(); sp.setCachedData(spData, false); spArray = (float[]) spData.get1DJavaArray(float.class); } catch (IOException e) { e.printStackTrace(); } return spArray; }
public long readToStream(Section section, OutputStream out) throws IOException, InvalidRangeException { if ((ncfile == null) || hasCachedData()) return IospHelper.copyToOutputStream( read(section), out); return ncfile.readToOutputStream(this, section, out); }
public float getRadialDistance(int gate) throws IOException { float gateStart = getRangeToFirstGate(); Variable gateSize = ds.findVariable("GateWidth"); float [] data = (float [])gateSize.read().get1DJavaArray(float.class); float dist = (float)(gateStart + gate*data[0]); return dist; }
public float[] readData() throws IOException { Array allData = null; int[] shape = sweepVar.getShape(); int[] origind = new int[sweepVar.getRank()]; try { allData = sweepVar.read(origind, shape); } catch (InvalidRangeException e) { throw new IOException(e.getMessage()); } return (float[]) allData.get1DJavaArray(float.class); }
public float getT(String tName, int swpNumber, int ray) throws IOException { Array timeData = ds.findVariable(tName).read(); Index timeIndex = timeData.getIndex(); return timeData.getFloat(timeIndex.set(swpNumber, ray)); }
public float getRadialDist(String dName, int gate) throws IOException { Array data = ds.findVariable(dName).read(); Index index = data.getIndex(); return data.getFloat(index.set(gate)); }
public float getRadialDistance(int gate) throws IOException { Variable sp = ds.findVariable("gate"); Array spData = sp.read(); sp.setCachedData(spData, false); Index index = spData.getIndex(); return spData.getFloat(index.set(gate)); }
static private void writeNcMLValues(Variable v, PrintStream out, Indent indent) throws IOException { Array data = v.read(); int width = formatValues(indent+"<values>", out, 0, indent); IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) width = formatValues(ii.next()+" ", out, width, indent); formatValues("</values>\n", out, width, indent); }
static private void writeNcMLValues(Variable v, Formatter out, Indent indent) throws IOException { Array data = v.read(); int width = formatValues(indent + "<values>", out, 0, indent); IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) width = formatValues(ii.next() + " ", out, width, indent); formatValues("</values>\n", out, width, indent); }
static private void writeNcMLValues(Variable v, PrintStream out, Indent indent) throws IOException { Array data = v.read(); int width = formatValues(indent+"<values>", out, 0, indent); IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) width = formatValues(ii.next()+" ", out, width, indent); formatValues("</values>\n", out, width, indent); }
void CheckInt32( Variable v) throws IOException { // int32 //assert(null != (v = dodsfile.findVariable("types.integers.i32"))); // assert v.getName().equals("types.integers.i32"); assert v.getRank() == 0; assert v.getSize() == 1; assert v.getDataType() == DataType.INT; CheckInt32Value(v.read()); }
void CheckByte( Variable v) throws IOException { assert v.getRank() == 0; assert v.getSize() == 1; assert v.getDataType() == DataType.UBYTE; CheckByteValue(v.read()); }
void CheckS( Variable v) throws IOException { // string //assert(null != (v = dodsfile.findVariable("types.strings.s"))); //assert v.getName().equals("types.strings.s"); assert v.getRank() == 0; assert v.getDataType() == DataType.STRING : v.getDataType(); CheckSValue(v.read()); }
@Test public void testEcmwfExtendedComplexData2() throws IOException { final String testfile = "../grib/src/test/data/complex_packing2.grib1"; try (NetcdfFile nc = NetcdfFile.open(testfile)) { Variable var = nc.findVariable("Snowfall_surface"); Array data = var.read(); float first = data.getFloat(0); Assert.assertEquals(.326607, first, 1e-6); } }
void CheckUint32( Variable v) throws IOException { // uint32 //assert(null != (v = dodsfile.findVariable("types.integers.ui32"))); //assert v.getName().equals("types.integers.ui32"); assert v.getRank() == 0; assert v.getSize() == 1; assert v.getDataType() == DataType.UINT : v.getDataType(); CheckUint32Value(v.read()); }
void CheckUint16( Variable v) throws IOException { // uint16 //assert(null != (v = dodsfile.findVariable("types.integers.ui16"))); //assert v.getName().equals("types.integers.ui16"); assert v.getRank() == 0; assert v.getSize() == 1; assert v.getDataType() == DataType.USHORT : v.getDataType(); CheckUInt16Value(v.read()); }
@Test public void zeroLenData() throws IOException { try (NetcdfFile ncremote = new CdmRemote(TestOnLocalServer.withHttpPath(urlPath + "/netcdf3/longOffset.nc"))) { Variable v = ncremote.findVariable(null, "time_whole"); Array data = v.read(); assert data.getSize() == 0; } }