use of org.jpl7.Variable in project vcell by virtualcell.
the class NetCDFRefDataReader method getRegionVar.
public double[][] getRegionVar() throws IOException {
if ((this != null) && (getRegionVariable() != null)) {
Variable regionVars = getRegionVariable();
int[] shape = regionVars.getShape();
@SuppressWarnings("unused") ArrayDouble.D2 data = null;
try {
data = (ArrayDouble.D2) regionVars.read();
} catch (Exception e) {
e.printStackTrace(System.err);
throw new IOException("Can not read species' names from the model.");
}
int numRois = shape[1];
int numTimePoints = shape[0];
double[][] values = new double[numRois][numTimePoints];
for (int i = 0; i < numRois; i++) {
values[i] = getRegionVar_one(i);
}
// }
return values;
}
return null;
}
use of org.jpl7.Variable in project vcell by virtualcell.
the class NetCDFReader method getTimePoints.
public double[] getTimePoints() throws IOException {
if ((this != null) && (getTime() != null)) {
Variable time = getTime();
int[] shape = time.getShape();
double[] timePoints = new double[shape[0]];
ArrayDouble.D1 data = null;
try {
data = (ArrayDouble.D1) time.read();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
throw new IOException("Can not read time points from the model.");
}
for (int i = 0; i < shape[0]; i++) {
timePoints[i] = data.get(i);
}
return timePoints;
}
return null;
}
use of org.jpl7.Variable in project vcell by virtualcell.
the class NetCDFReader method getLastModel.
/**
* Get last model.
* @return int. last model.
*/
public int getLastModel() throws IOException {
Variable v = ncfile.findVariable("LastModel");
int val = 0;
try {
val = v.readScalarInt();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
throw new IOException("Cannot get proper last model number from the file.");
}
return val;
}
use of org.jpl7.Variable in project vcell by virtualcell.
the class NetCDFReader method getMaxNumModels.
/**
* Get max number of models.
* @return int. max number of models.
*/
public int getMaxNumModels() throws IOException {
Variable v = ncfile.findVariable("MaxNumModels");
int val = 0;
try {
val = v.readScalarInt();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
throw new IOException("Cannot get proper max number of models from the file.");
}
return val;
}
use of org.jpl7.Variable in project vcell by virtualcell.
the class NetCDFReader method getVolume.
/**
* Get volume.
* @return double, volume.
*/
public double getVolume() throws IOException {
Variable v = ncfile.findVariable("Volume");
Double val = 0.0;
try {
val = v.readScalarDouble();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
throw new IOException("Cannot get proper volume from the model.");
}
return val;
}
Aggregations