/** * For netcdf3 only, take all unlimited variables and make them into a structure. * @return the record Structure, or null if not done. */ public Structure addRecordStructure() { if (version != Version.netcdf3) return null; boolean ok = (Boolean) ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if (!ok) throw new IllegalStateException("can't add record variable"); return (Structure) ncfile.findVariable("record"); }
/** * For netcdf3 only, take all unlimited variables and make them into a structure. * @return the record Structure, or null if not done. */ public Structure addRecordStructure() { if (version != Version.netcdf3) return null; boolean ok = (Boolean) ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if (!ok) throw new IllegalStateException("can't add record variable"); return (Structure) ncfile.findVariable("record"); }
public Structure addRecordStructure() { if (version.isNetdf4format()) return null; boolean ok = (Boolean) ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if (!ok) throw new IllegalStateException("can't add record variable"); return (Structure) ncfile.findVariable("record"); }
protected void setUp() throws Exception { ncfile = NetcdfFile.open(TestDir.cdmUnitTestDir+"ft/station/Surface_METAR_20080205_0000.nc"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); } protected void tearDown() throws Exception {
protected void setUp() throws Exception { ncfile = TestDir.openFileLocal("testStructures.nc"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); } protected void tearDown() throws Exception {
protected void setUp() throws Exception { ncfile = TestDir.openFileLocal("testWriteRecord.nc"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); }
public void testReadLongOffset() throws IOException { try (NetcdfFile ncfile = TestDir.openFileLocal("longOffset.nc")) { ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); StringWriter sw = new StringWriter(); NCdumpW.print(ncfile, "-vall", sw, null); logger.debug(sw.toString()); } }
oldFile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); recordVar = (Structure) oldFile.findVariable("record");
@Test public void testReadData() throws IOException { long start = System.currentTimeMillis(); long totalBytes = 0; try (NetcdfFile ncfile = NetcdfFile.open(url)) { Object mess = ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_RANDOM_ACCESS_FILE); assert mess != null; assert mess instanceof HTTPRandomAccessFile; totalBytes = readAllData(ncfile); } finally { System.out.printf("**testRad Data took= %d msecs %d kbytes%n", (System.currentTimeMillis() - start), totalBytes / 1000); } }
ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE); ncfile.finish();
ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE); ncfile.finish();
public void readBothWays(String filename) throws IOException { NetcdfFile ncfile = NetcdfFile.open(filename); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); //System.out.println(ncfile); ncfile.close(); ncfile = NetcdfFile.open(filename); //System.out.println(ncfile); ncfile.close(); }
if (this.orgFile == null) return false; Boolean hasRecord = (Boolean) this.orgFile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if ((hasRecord == null) || !hasRecord) return false;
public void testBB() throws IOException, InvalidRangeException { NetcdfFile ncfile = TestDir.openFileLocal("testWriteRecord.nc"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); Structure v = (Structure) ncfile.findVariable("record"); assert v != null; assert( v.getDataType() == DataType.STRUCTURE); Array data = v.read(); assert( data instanceof ArrayStructure); assert( data instanceof ArrayStructureBB); assert(data.getElementType() == StructureData.class); test.testArrayStructure( (ArrayStructure) data); ncfile.close(); }
if (this.orgFile == null) return false; Boolean hasRecord = (Boolean) this.orgFile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if ((hasRecord == null) || !hasRecord) return false;
if (this.orgFile == null) return false; Boolean hasRecord = (Boolean) this.orgFile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); if ((hasRecord == null) || !hasRecord) return false;
public void testCachedDataWithStructure() throws IOException { NetcdfFile ncd = null; try { ncd = NetcdfDataset.openFile(TestDir.cdmLocalTestDataDir + "point/profileMultidim.ncml", null); boolean ok = (Boolean) ncd.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); assert ok; Variable s = ncd.findVariable("record"); assert s != null; assert s instanceof Structure; assert s.getSize() == 5 : s.getSize(); Array data = s.read(); assert data.getSize() == 5 : data.getSize(); } finally { if (ncd != null) ncd.close(); } }
public void testStructureIterator() throws IOException, InvalidRangeException { NetcdfFile ncfile = NetcdfFile.open(TestDir.cdmUnitTestDir + "ft/station/Surface_METAR_20080205_0000.nc"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); Structure v = (Structure) ncfile.findVariable("record"); assert v != null; assert (v.getDataType() == DataType.STRUCTURE); int count = 0; try (StructureDataIterator si = v.getStructureIterator()) { while (si.hasNext()) { StructureData sd = si.next(); count++; } } assert count == v.getSize(); ncfile.close(); } }
public void testNC3ReadRecordStrided() throws InvalidRangeException, IOException { NetcdfFile nc = TestDir.openFileLocal("testWriteRecord.nc"); nc.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE);
assert v.getUnitsString().equals("meters"); ncfile.sendIospMessage(NetcdfFile.IOSP_MESSAGE_ADD_RECORD_STRUCTURE); Structure s = (Structure) ncfile.findVariable("record"); assert (s != null);