|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.data.DataUtil
public class DataUtil
A class to hold general utility functions for manipulating data
| Field Summary | |
|---|---|
static String |
STD_ATMOSPHERE
flag for standard atmosphere coordinate system class |
static String |
VIS5D_VERTICALCS
flag for Vis5D pressure to height coordinate system class |
| Constructor Summary | |
|---|---|
DataUtil()
|
|
| Method Summary | |
|---|---|
static void |
absoluteValue(float[][] originalValues,
float[][] newValues,
int[] indexArray)
copy the originalValues to the new values. |
static void |
average(float[][] originalValues,
float[][] newValues,
int[] indexArray)
set newValues to be the average of the original values in the index array |
static String |
cleanName(String name)
Make a valid VisAD RealType name from the string. |
static float[][] |
cloneArray(float[][] a)
clone the array |
static FlatField |
getFlatField(Data field)
This method find the flat field somewhere in the given data |
static CoordinateSystem |
getPressureToHeightCS(String type)
Get the appropriate vertical coordinate system |
static float[][] |
makeFloatArray(int rows,
int cols,
float value)
Make a float array of the sizes indicated with the value |
static RealType |
makeRealType(String name,
Unit unit)
Try to create a RealType from the name and unit. |
static TextType |
makeTextType(String name)
Try to create a TextType from the name. |
static void |
max(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
Copy the values in originalValues[indexArray] that are greater than the given value to newValues |
static void |
min(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
If the originalValues < given value then set the newValues = value |
static Unit |
parseUnit(String unitString)
Tries to parse the string. |
static boolean |
pointInside(float[][] pts,
float x,
float y)
Determine if the given point is inside the given polygon Code originally taken from: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html Copyright (c) 1970-2003, Wm. |
static List<Date> |
selectDatesFromList(List sourceTimes,
List<DateTime> driverTimes)
_more_ |
static List<DateTime> |
selectTimesFromList(List sourceTimes,
List<DateTime> selectionTimes)
_more_ |
static void |
setValue(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
set the values in the indices in newValues = the given value |
static char[] |
toCharArray(ucar.ma2.Array arr)
Get the 1D values for an array as chars. |
static double[] |
toDoubleArray(ucar.ma2.Array arr)
Get the 1D values for an array as doubles. |
static float[] |
toFloatArray(ucar.ma2.Array arr)
Get the 1D values for an array as floats. |
static String[] |
toStringArray(ucar.ma2.Array arr)
Get the 1D values for an array as Strings. |
static void |
writeCsv(String filename,
List rows)
Write a csv file. |
static void |
writeXls(String filename,
List rows)
Write to an excel spreadsheet |
static void |
writeXls(String filename,
List<List> rowsList,
List<String> names)
Write to an excel spreadsheet |
static String |
xlsToCsv(String filename)
Convert excel to csv |
static String |
xlsToCsv(String filename,
boolean skipToFirstNumeric,
SimpleDateFormat sdf)
Convert excel to csv |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String STD_ATMOSPHERE
public static final String VIS5D_VERTICALCS
| Constructor Detail |
|---|
public DataUtil()
| Method Detail |
|---|
public static float[] toFloatArray(ucar.ma2.Array arr)
arr - Array of values
public static double[] toDoubleArray(ucar.ma2.Array arr)
arr - Array of values
public static String[] toStringArray(ucar.ma2.Array arr)
arr - Array of values
public static char[] toCharArray(ucar.ma2.Array arr)
arr - Array of values
public static Unit parseUnit(String unitString)
unitString - The unit string
public static TextType makeTextType(String name)
name - name of type
public static RealType makeRealType(String name,
Unit unit)
name - name of typeunit - can be null
public static String cleanName(String name)
name - name to clean
public static CoordinateSystem getPressureToHeightCS(String type)
throws VisADException
type - type of pressure to height cs
VisADException - couldn't create the CS
public static float[][] makeFloatArray(int rows,
int cols,
float value)
rows - number of arrayscols - number of values in each rowvalue - fill value
public static float[][] cloneArray(float[][] a)
a - incoming array
public static void absoluteValue(float[][] originalValues,
float[][] newValues,
int[] indexArray)
originalValues - original valuesnewValues - new valuesindexArray - The indices to change
public static void max(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
originalValues - original valuesnewValues - new ValuesindexArray - indicesvalue - the threshold value
public static void setValue(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
originalValues - originalValuesnewValues - newValuesindexArray - indicesvalue - value
public static void min(float[][] originalValues,
float[][] newValues,
int[] indexArray,
float value)
originalValues - originalValuesnewValues - newValuesindexArray - indicesvalue - value
public static void average(float[][] originalValues,
float[][] newValues,
int[] indexArray)
originalValues - original valuesnewValues - new valueindexArray - indices
public static FlatField getFlatField(Data field)
throws VisADException,
RemoteException
field - field
RemoteException - on badness
VisADException - on badness
public static void writeCsv(String filename,
List rows)
filename - file to write torows - data
public static void writeXls(String filename,
List rows)
throws Exception
filename - filerows - data
Exception - On badness
public static void writeXls(String filename,
List<List> rowsList,
List<String> names)
throws Exception
filename - filerowsList - datanames - sheet names
Exception - On badness
public static String xlsToCsv(String filename)
throws Exception
filename - excel file
Exception - On badness
public static String xlsToCsv(String filename,
boolean skipToFirstNumeric,
SimpleDateFormat sdf)
throws Exception
filename - excel fileskipToFirstNumeric - _more_sdf - If non null then use this to format any date cells
Exception - On badness
public static boolean pointInside(float[][] pts,
float x,
float y)
pts - _more_x - _more_y - _more_
public static List<Date> selectDatesFromList(List sourceTimes,
List<DateTime> driverTimes)
throws Exception
sourceTimes - _more_driverTimes - _more_
Exception - _more_
public static List<DateTime> selectTimesFromList(List sourceTimes,
List<DateTime> selectionTimes)
throws Exception
sourceTimes - _more_selectionTimes - _more_
Exception - _more_
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||