edu.wisc.ssec.mcidas.adde
Class AddePointDataReader
- java.lang.Object
-
- edu.wisc.ssec.mcidas.adde.AddePointDataReader
-
public class AddePointDataReader extends java.lang.ObjectAddePointDataReader interface for McIDAS ADDE point data sets. Simulates a McIDAS PTLIST output using an ADDE URL iftoString() method is used. Note that units are ignored by this client, default units are used.URLs must all have the following format adde://host/point?keyword_1=value_1&keyword_2=value_2 there can be any valid combination of the following supported keywords: group=<groupname> ADDE group name descr=<descriptor> ADDE descriptor name pos=<position> request an absolute or relative ADDE position number select=<select clause> to specify which data is required param=<param list> what parameters to return num=<max> maximum number of obs to return user=<user_id> ADDE user identification proj=<proj #> a valid ADDE project number trace=<0/1> setting to 1 tells server to write debug trace file (imagedata, imagedirectory) version=1 ADDE version number, currently 1 the following keywords are required: group descr an example URL might look like: adde://rtds/point?group=neons&type=metar
-
-
Field Summary
Fields Modifier and Type Field and Description static intMAXNUMPARMMaximum number of parameters - used as a sanity checkstatic intOB_ORDERKey for getting data in obs order [numObs][numParams]static intPARAM_ORDERKey for getting data in param order [numParams][numObs]
-
Constructor Summary
Constructors Constructor and Description AddePointDataReader(java.lang.String request)creates an AddePointDataReader object that allows reading ADDE point datasets.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description int[][]getData()Return the data sent by the serverint[][]getData(int order)Return the data sent by the server in a particular order (PARAM_ORDER, OB_ORDER).java.lang.Object[]getData(java.lang.String parameter)Return an array of data for the particular parameter.intgetNumParams()return the number of parametersjava.lang.String[]getParams()Get the list of parametersint[]getScales()Get the list of scaling factorsjava.lang.String[]getUnits()Get the list of unitsstatic voidmain(java.lang.String[] args)test by running 'java edu.wisc.ssec.mcidas.adde.AddePointDataReader'java.lang.StringtoString()Return a formated string of the returned data
-
-
-
Field Detail
-
PARAM_ORDER
public static final int PARAM_ORDER
Key for getting data in param order [numParams][numObs]- See Also:
- Constant Field Values
-
OB_ORDER
public static final int OB_ORDER
Key for getting data in obs order [numObs][numParams]- See Also:
- Constant Field Values
-
MAXNUMPARM
public static final int MAXNUMPARM
Maximum number of parameters - used as a sanity check- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AddePointDataReader
public AddePointDataReader(java.lang.String request) throws AddeExceptioncreates an AddePointDataReader object that allows reading ADDE point datasets.- Parameters:
request- ADDE URL to read from. See class javadoc.an example URL might look like: adde://rtds.ho.bom.gov.au/point?group=neons&descr=metar
- Throws:
AddeException- if there are no datasets of the particular type or there is an error reading data
-
-
Method Detail
-
getData
public int[][] getData() throws AddeExceptionReturn the data sent by the server- Returns:
- array of the data. Data is in the format of an integer array of unscaled integers as returned from the server in parameter order ([numParams][numObs]).
- Throws:
AddeException- if there was an error reading data
-
getData
public int[][] getData(int order) throws AddeExceptionReturn the data sent by the server in a particular order (PARAM_ORDER, OB_ORDER).- Parameters:
order- order of the data. (PARAM_ORDER, OB_ORDER)- Returns:
- array of the data. Data is in the format of an integer array of unscaled integers in the specified order (PARAM_ORDER = [numParams][numObs], OB_ORDER = [numObs][numParams])
- Throws:
AddeException- if there was an error reading data
-
getParams
public java.lang.String[] getParams() throws AddeExceptionGet the list of parameters- Returns:
- array of the parameter names. The names will be in the same
order as the array of data values in the
getData()method. - Throws:
AddeException- if there was an error reading data
-
getUnits
public java.lang.String[] getUnits() throws AddeExceptionGet the list of units- Returns:
- array of the unit names. The names will be in the same
order as the array of data values in the
getData()method. - Throws:
AddeException- if there was an error reading data
-
getScales
public int[] getScales() throws AddeExceptionGet the list of scaling factors- Returns:
- array of the scaling factors (powers of 10). The scaling
factors will be in the same order as the array of data
values in the
getData()method. - Throws:
AddeException- if there was an error reading data
-
getNumParams
public int getNumParams() throws AddeExceptionreturn the number of parameters- Returns:
- number of parameters returned from the server
- Throws:
AddeException
-
getData
public java.lang.Object[] getData(java.lang.String parameter) throws AddeExceptionReturn an array of data for the particular parameter.- Returns:
- array of values for the particular parameter or null if an invalid parameter was entered. This will return String[] for parameters with units of CHAR, float[1][] for an array of non scaled data, and double[1][] for
- Throws:
AddeException
-
toString
public java.lang.String toString()
Return a formated string of the returned data- Overrides:
toStringin classjava.lang.Object- Returns:
- formatted representation of the data ala McIDAS PTLIST command.
-
main
public static void main(java.lang.String[] args) throws java.lang.Exceptiontest by running 'java edu.wisc.ssec.mcidas.adde.AddePointDataReader'- Throws:
java.lang.Exception
-
-
DMelt 3.0 © DataMelt by jWork.ORG