public void testSingleDataset() throws IOException { InvCatalogImpl cat = TestTDSAll.open(null); InvDataset ds = cat.findDatasetByID("testSingleDataset"); assert (ds != null) : "cant find dataset 'testSingleDataset'"; assert ds.getDataType() == FeatureType.GRID; ThreddsDataFactory fac = new ThreddsDataFactory(); ThreddsDataFactory.Result dataResult = fac.openFeatureDataset(ds, null); assert dataResult != null; assert !dataResult.fatalError; assert dataResult.featureDataset != null; GridDataset gds = (GridDataset) dataResult.featureDataset; GridDatatype grid = gds.findGridDatatype("Z_sfc"); assert grid != null; GridCoordSystem gcs = grid.getCoordinateSystem(); assert gcs != null; assert null == gcs.getVerticalAxis(); CoordinateAxis1D time = gcs.getTimeAxis1D(); assert time != null; assert time.getSize() == 1; assert 102840.0 == time.readScalarDouble(); dataResult.featureDataset.close(); }
public void setDataset(InvDataset ds) { if (ds == null) return; OpenDatasetTask openTask = new OpenDatasetTask(ds); ProgressMonitor pm = new ProgressMonitor(openTask); pm.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("success")) { controller.showDataset(); gridTable.setDataset(controller.getFields()); datasetNameLabel.setText("Dataset: " + controller.getDatasetUrlString()); setSelected(true); gtWindow.hide(); } } }); pm.start(this, "Open Dataset " + ds.getName(), 100); }