Search in sources :

Example 6 with Variable

use of org.flyte.api.v1.Variable in project vcell by virtualcell.

the class NetCDFReader method getEndTime.

/**
 * Get ending time. 0 dimenstion
 * @return double, ending time.
 */
public double getEndTime() throws IOException {
    Variable v = ncfile.findVariable("TEnd");
    Double val = 0.0;
    try {
        val = v.readScalarDouble();
    } catch (IOException ioe) {
        ioe.printStackTrace(System.err);
        throw new IOException("Cannot get proper ending time from the model.");
    }
    return val;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException) ArrayDouble(ucar.ma2.ArrayDouble)

Example 7 with Variable

use of org.flyte.api.v1.Variable in project vcell by virtualcell.

the class NetCDFReader method getCellGrowthTimeSD.

/**
 * Get cell growth time SD, which is the standard deviation of the time between cell divisions.
 * @return double, standard deviation of cell growth time.
 */
public double getCellGrowthTimeSD() throws IOException {
    Variable v = ncfile.findVariable("CellGrowthTimeSD");
    Double val = 0.0;
    try {
        val = v.readScalarDouble();
    } catch (IOException ioe) {
        ioe.printStackTrace(System.err);
        throw new IOException("Cannot get proper standard deviation of the time between cell divisions from the model.");
    }
    return val;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException) ArrayDouble(ucar.ma2.ArrayDouble)

Example 8 with Variable

use of org.flyte.api.v1.Variable in project vcell by virtualcell.

the class NetCDFReader method getNumModels_Variable.

/**
 * Get Number of Models.
 * @return int. number of models.
 */
public int getNumModels_Variable() throws IOException {
    Variable v = ncfile.findVariable("NumModels");
    int val = 0;
    try {
        val = v.readScalarInt();
    } catch (IOException ioe) {
        ioe.printStackTrace(System.err);
        throw new IOException("Cannot get proper variable of number of models from the file.");
    }
    return val;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException)

Example 9 with Variable

use of org.flyte.api.v1.Variable in project vcell by virtualcell.

the class NetCDFReader method getCellGrowthTime.

/**
 * Get cell growth time, which is the average amount of time between cell divisions.
 * @return double, cell growth time.
 */
public double getCellGrowthTime() throws IOException {
    Variable v = ncfile.findVariable("CellGrowthTime");
    Double val = 0.0;
    try {
        val = v.readScalarDouble();
    } catch (IOException ioe) {
        ioe.printStackTrace(System.err);
        throw new IOException("Cannot get proper cell growth time from the model.");
    }
    return val;
}
Also used : Variable(ucar.nc2.Variable) IOException(java.io.IOException) ArrayDouble(ucar.ma2.ArrayDouble)

Example 10 with Variable

use of org.flyte.api.v1.Variable in project vcell by virtualcell.

the class NetCDFReader method getSpeciesNames_val.

/**
 * Get the real string of species' names. The species' names are stored
 * in a 2 dimentional structure. First dimension is the number of speceis
 * and the second dimension is the allowed string length of the names(default=25).
 * @return String[], the list of the species' names in the model.
 */
public String[] getSpeciesNames_val() throws IOException {
    if ((this != null) && (getSpeciesNames() != null)) {
        Variable snames = getSpeciesNames();
        int[] shape = snames.getShape();
        String[] result = new String[shape[0]];
        ArrayChar.D2 data = null;
        try {
            data = (ArrayChar.D2) snames.read();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new IOException("Can not read species' names from the model.");
        }
        for (int i = 0; i < shape[0]; i++) {
            char[] name = new char[shape[1]];
            for (int j = 0; j < shape[1]; j++) {
                name[j] = data.get(i, j);
            }
            result[i] = new String(name).trim();
        }
        // }
        return result;
    }
    return null;
}
Also used : Variable(ucar.nc2.Variable) ArrayChar(ucar.ma2.ArrayChar) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

Variable (ucar.nc2.Variable)78 IOException (java.io.IOException)41 Variable (org.jpl7.Variable)33 Query (org.jpl7.Query)32 Term (org.jpl7.Term)29 Array (ucar.ma2.Array)21 Attribute (ucar.nc2.Attribute)21 Compound (org.jpl7.Compound)19 NetcdfFile (ucar.nc2.NetcdfFile)18 Map (java.util.Map)17 Dimension (ucar.nc2.Dimension)17 InvalidRangeException (ucar.ma2.InvalidRangeException)16 ArrayList (java.util.ArrayList)15 Atom (org.jpl7.Atom)15 ArrayDouble (ucar.ma2.ArrayDouble)14 File (java.io.File)10 List (java.util.List)9 ArrayFloat (ucar.ma2.ArrayFloat)9 WritableRaster (java.awt.image.WritableRaster)8 HashMap (java.util.HashMap)8