ui/src/main/java/ucar/nc2/ui/op/DatasetViewer.java
private void dataTable(BeanTable from) {
    VariableBean vb = (VariableBean) from.getSelectedBean();
    if (vb == null) return;
    Variable v = vb.vs;
    if (v instanceof Structure) {
      try {
        dataTable.setStructure((Structure)v);
      }
      catch (Exception ex) {
        ex.printStackTrace();
      }
      dataWindow.setComponent(dataTable);
  	}
  	else {
	  List<VariableBean> l = from.getSelectedBeans();
	  List<Variable> vl = new ArrayList<>();

	  for(VariableBean vb1  : l) {
		  if (vb1 == null) return;
		  v = vb1.vs;
		  if (v != null) {
			  vl.add(v);
		  }
		  else return;
	  }
 
	  variableTable.setDataset(ds);
	  variableTable.setVariableList(vl);
	  variableTable.createTable();
 
	  dataWindow.setComponent(variableTable);
    }
    Rectangle r = (Rectangle) prefs.getBean("dataWindowBounds", new Rectangle( 50, 300, 1000, 1200));
    dataWindow.setBounds(r);
  	dataWindow.show();
  }
private void dataTable(BeanTable from) {
    VariableBean vb = (VariableBean) from.getSelectedBean();
    if (vb == null) return;
    Variable v = vb.vs;
    if (v instanceof Structure) {
      try {
        dataTable.setStructure((Structure)v);
      }
      catch (Exception ex) {
        ex.printStackTrace();
      }
      dataWindow.setComponent(dataTable);
  	}
  	else {
	  List<VariableBean> l = from.getSelectedBeans();
	  List<Variable> vl = new ArrayList<>();

	  for(VariableBean vb1  : l) {
		  if (vb1 == null) return;
		  v = vb1.vs;
		  if (v != null) {
			  vl.add(v);
		  }
		  else return;
	  }
 
	  variableTable.setDataset(ds);
	  variableTable.setVariableList(vl);
	  variableTable.createTable();
 
	  dataWindow.setComponent(variableTable);
    }
    Rectangle r = (Rectangle) prefs.getBean("dataWindowBounds", new Rectangle( 50, 300, 1000, 1200));
    dataWindow.setBounds(r);
  	dataWindow.show();
  }
private void dataTable ( BeanTable from ) { VariableBean vb = ( VariableBean ) from . getSelectedBean ( ) ; if ( vb == null ) return ; Variable v = vb . vs ; if ( v instanceof Structure ) { try { dataTable . setStructure ( ( Structure ) v ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } dataWindow . setComponent ( dataTable ) ; } else { List < VariableBean > l = from . getSelectedBeans ( ) ; List < Variable > vl = new ArrayList <> ( ) ; for ( VariableBean vb1 : l ) { if ( vb1 == null ) return ; v = vb1 . vs ; if ( v != null ) { vl . add ( v ) ; } else return ; } variableTable . setDataset ( ds ) ; variableTable . setVariableList ( vl ) ; variableTable . createTable ( ) ; dataWindow . setComponent ( variableTable ) ; } Rectangle r = ( Rectangle ) prefs . getBean ( "dataWindowBounds" , new Rectangle ( 50 , 300 , 1000 , 1200 ) ) ; dataWindow . setBounds ( r ) ; dataWindow . show ( ) ; }
/* private void showMissingData(BeanTable from) {
VariableBean vb = (VariableBean) from.getSelectedBean();
if (vb == null) return;
Variable v = vb.vs;
if ((v != null) && (v.getDataType() == ucar.nc2.DataType.STRUCTURE)) {
showMissingStructureData( (Structure) v);
}
if (!vb.vs.hasMissing()) return;

int count = 0, total = 0;
infoTA.clear();
infoTA.appendLine( v.toString());
try {

Array data = null;
if (v.isMemberOfStructure())
data = v.readAllStructures((List)null, true);
else
data = v.read();

IndexIterator iter = data.getIndexIterator();
while (iter.hasNext()) {
if (vb.vs.isMissing( iter.getDoubleNext()))
count++;
total++;
}

double p = ((100.0 * count) / total);
infoTA.appendLine( " missing values = "+count);
infoTA.appendLine( " total values = "+total);
infoTA.appendLine( " percent missing values = "+ Format.d(p, 2) +" %");

} catch( InvalidRangeException e ) {
infoTA.appendLine( "ERROR= "+e.getMessage());
} catch( IOException ioe ) {
infoTA.appendLine( "ERROR= "+ioe.getMessage());
}
infoTA.gotoTop();
infoWindow.showIfNotIconified();
}

private void showMissingStructureData(Structure s) {
ArrayList members = new ArrayList();
List allMembers = s.getVariables();
for (int i=0; i<allMembers.size(); i++) {
Variable vs = (Variable) allMembers.get(i);
if (vs.hasMissing())
members.add( vs);
}

if (members.size() == 0) return;
int[] count = new int[ members.size()];
int[] total = new int[ members.size()];

infoTA.clear();
try {

Structure.Iterator iter = s.getStructureIterator();
while (iter.hasNext()) {
StructureData sdata = iter.next();

for (int i=0; i<members.size(); i++) {
Variable vs = (Variable) members.get(i);

Array data = sdata.findMemberArray( vs.getShortName());
IndexIterator dataIter = data.getIndexIterator();
while (dataIter.hasNext()) {
if (vs.isMissing(dataIter.getDoubleNext()))
count[i]++;
total[i]++;
}
}
}
int countAll = 0, totalAll = 0;
infoTA.appendLine("      name                missing   total     percent missing");
for (int i=0; i<members.size(); i++) {
Variable vs = (Variable) members.get(i);
double p = ( (100.0 * count[i]) / total[i]);
infoTA.appendLine(Format.s(vs.getShortName(), 25) +
" "+ Format.i(count[i], 7) +
"   "+ Format.i(total[i], 7) +
"   "+ Format.d(p, 2) + "%");
countAll += count[i];
totalAll += total[i];
}

infoTA.appendLine("");
double p = ( (100.0 * countAll) / totalAll);
infoTA.appendLine(Format.s("TOTAL ALL", 25) +
" "+ Format.i(countAll, 7) +
"   "+ Format.i(totalAll, 7) +
"   "+ Format.d(p, 2) + "%");

} catch( IOException ioe ) {
infoTA.appendLine( "ERROR= "+ioe.getMessage());
}
infoTA.gotoTop();
infoWindow.showIfNotIconified();
}
/ * private void showMissingData ( BeanTable from ) { VariableBean vb = ( VariableBean ) from . getSelectedBean () ; if ( vb == null ) return ; Variable v = vb . vs ; if (( v ! = null ) && ( v . getDataType () == ucar . nc2 . DataType . STRUCTURE )) { showMissingStructureData ( ( Structure ) v ) ; } if ( !vb . vs . hasMissing () ) return ;