Search in sources :

Example 46 with Variable

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;
}
Also used : Variable(ucar.nc2.Variable) ArrayDouble(ucar.ma2.ArrayDouble) IOException(java.io.IOException) IOException(java.io.IOException)

Example 47 with Variable

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;
}
Also used : Variable(ucar.nc2.Variable) ArrayDouble(ucar.ma2.ArrayDouble) IOException(java.io.IOException)

Example 48 with Variable

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;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException)

Example 49 with Variable

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;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException)

Example 50 with Variable

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;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException) ArrayDouble(ucar.ma2.ArrayDouble)

Aggregations

Query (org.jpl7.Query)25 Variable (org.jpl7.Variable)24 Term (org.jpl7.Term)23 Variable (ucar.nc2.Variable)21 IOException (java.io.IOException)19 Compound (org.jpl7.Compound)17 Atom (org.jpl7.Atom)12 ArrayDouble (ucar.ma2.ArrayDouble)10 Map (java.util.Map)9 Integer (org.jpl7.Integer)4 org.jpl7.fli.term_t (org.jpl7.fli.term_t)4 Attribute (ucar.nc2.Attribute)4 BigInteger (java.math.BigInteger)3 Group (ucar.nc2.Group)3 TikaException (org.apache.tika.exception.TikaException)2 TemporaryResources (org.apache.tika.io.TemporaryResources)2 TikaInputStream (org.apache.tika.io.TikaInputStream)2 Property (org.apache.tika.metadata.Property)2 XHTMLContentHandler (org.apache.tika.sax.XHTMLContentHandler)2 Dimension (ucar.nc2.Dimension)2