|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.data.grid.GridUtil
public class GridUtil
Set of static methods for messing with grids. A grid is defined as a FieldImpl which has one of the following MathTypes structures:
(x,y) -> (parm) (x,y) -> (parm1, ..., parmN) (x,y,z) -> (parm) (x,y,z) -> (parm1, ..., parmN) (t -> (x,y) -> (parm)) (t -> (x,y) -> (parm1, ..., parmN)) (t -> (x,y,z) -> (parm)) (t -> (x,y,z) -> (parm1, ..., parmN)) (t -> (index -> (x,y) -> (parm))) (t -> (index -> (x,y) -> (parm1, ..., parmN))) (t -> (index -> (x,y,z) -> (parm))) (t -> (index -> (x,y,z) -> (parm1, ..., parmN)))In general, t is a time variable, but it might also be just an index.
| Field Summary | |
|---|---|
static int |
DEFAULT_ERROR_MODE
Default error mode used for subsampling grids |
static int |
DEFAULT_SAMPLING_MODE
Default sampling mode used for subsampling grids |
| Constructor Summary | |
|---|---|
GridUtil()
Default ctor |
|
| Method Summary | |
|---|---|
static boolean |
canSliceAtLevel(FieldImpl grid,
Real level)
Determine whether the grid in question can be sliced at the level specified (i.e., units or CS allows this) |
static boolean |
canSliceAtLevel(SampledSet spatialSet,
Real level)
Determine whether the set in question can be sliced at the level specified (i.e., units or CS allows this) |
FieldImpl |
extractParam(FieldImpl grid,
MathType paramType)
Extract a single parameter from a grid of multiple parameters. |
static FieldImpl |
extractParam(FieldImpl grid,
ScalarType param)
Extract the param from a sequence, it will be the range type of the individual elements. |
static Range[] |
fieldMinMax(FlatField field)
Find min and max of range data in any VisAD FlatField |
static int[][] |
findContainedIndices(float[][] latlon,
UnionSet map)
Find the indices of the latlon values contained in the map |
static int[][] |
findContainedIndices(GriddedSet domain,
UnionSet map)
Find the indices of the domain values contained in the map |
static Real |
getAltitude(FieldImpl grid,
Real level)
Get the altitude corresponding to the level specified using the domain of the grid. |
static LatLonPoint |
getCenterLatLonPoint(FieldImpl grid)
Get the latitude/longitude point at the center of the grid. |
static LatLonPoint |
getCenterLatLonPoint(SampledSet spatialDomain)
Get the latitude/longitude point at the center of the domain. |
static RealTuple |
getCenterPoint(FieldImpl grid)
Method to get the center point of a grid's spatial domain as a RealTuple. |
static RealTuple |
getCenterPoint(SampledSet spatialDomain)
Method to get the center point of a spatial domain as a RealTuple. |
static List |
getDateTimeList(FieldImpl grid)
Get the list of DateTime objects from the domain of the given grid |
static float[][] |
getEarthLocationPoints(GriddedSet domain)
Convert the domain to the reference earth located points |
static FieldImpl |
getGridAsPointObs(FieldImpl grid)
Convert a grid to point obs |
static float[][] |
getLatLon(GriddedSet domain)
Convert the domain to the reference earth located points. |
static Real |
getLevel(FieldImpl grid,
Real altitude)
Get the altitude corresponding to the level specified using the domain of the grid. |
static Range[] |
getMinMax(FieldImpl fieldImpl)
get max and min of all range values in the current active fieldImpl |
static MapProjection |
getNavigation(FieldImpl grid)
Get the navigation for this grid |
static MapProjection |
getNavigation(SampledSet spatialSet)
Get the navigation for this spatialDomain |
static FieldImpl |
getParam(FieldImpl grid,
int index)
Extract the range MathType of the lowest element. |
static FieldImpl |
getParam(FieldImpl grid,
int index,
boolean copy)
Extract the range MathType of the lowest element. |
static TupleType |
getParamType(FieldImpl grid)
Get the range MathType of the lowest element. |
static Unit[] |
getParamUnits(FieldImpl grid)
Get the range MathType of the lowest element. |
static FieldImpl |
getProfileAtLatLonPoint(FieldImpl grid,
LatLonPoint point)
Returns a vertical profile of a grid at a Lat/Lon point. |
static FieldImpl |
getProfileAtLatLonPoint(FieldImpl grid,
LatLonPoint point,
int samplingMode)
Returns a vertical profile of a grid at a Lat/Lon point. |
static RealType |
getSequenceType(FieldImpl grid)
Get the RealType of the sequence. |
static SampledSet |
getSpatialDomain(FieldImpl grid)
Get the spatial domain for this grid. |
static SampledSet |
getSpatialDomain(FieldImpl grid,
int timeIndex)
Get the spatial domain for this grid at the specified time step. |
static Set |
getTimeSet(FieldImpl grid)
Get the time set from the grid. |
static RealType |
getVerticalType(FieldImpl grid)
Get the RealType of the vertical dimension of the spatial domain of the grid. |
static RealType |
getVerticalType(SampledSet domainSet)
Get the unit of the vertical dimension of the domain set. |
static Unit |
getVerticalUnit(FieldImpl grid)
Get the unit of the vertical dimension of the spatial domain of the grid. |
static Unit |
getVerticalUnit(SampledSet domainSet)
Get the unit of the vertical dimension of the domain. |
static boolean |
is2D(FieldImpl grid)
Check to see if this is a 2D grid |
static boolean |
is2D(SampledSet domainSet)
Check to see if this is a 2D domain |
static boolean |
is3D(FieldImpl grid)
Check to see if this is a 3D grid |
static boolean |
is3D(SampledSet domainSet)
Check to see if this is a 3D domain |
static boolean |
isAllMissing(FieldImpl field)
Check if all real values in a FieldImpl are missing. |
static boolean |
isAllMissing(FieldImpl grid,
boolean popupErrorMessage)
Check if all real values in a FieldImpl are missing. |
static boolean |
isConstantSpatialDomain(FieldImpl grid)
See if the spatial domain of this grid is constant (ie: not time varying) |
static boolean |
isGrid(FieldImpl field)
Check to see if this field is a grid that can be handled by these methods |
static boolean |
isLatLonOrder(FieldImpl grid)
Check to see if this is a navigated grid (domain can be converted to lat/lon) |
static boolean |
isLatLonOrder(SampledSet spatialSet)
Check to see if this is a navigated domain (can be converted to lat/lon) |
static boolean |
isNavigated(FieldImpl grid)
Check to see if this is a navigated grid (domain can be converted to lat/lon) |
static boolean |
isNavigated(SampledSet spatialSet)
Check to see if this is a navigated domain (can be converted to lat/lon) |
static boolean |
isSequence(FieldImpl grid)
Check to see if this is a single grid or if it is a sequence of grids. |
static boolean |
isSinglePointDomain(FieldImpl grid)
See if the domain of the grid is a single point (only 1 x and y value). |
static boolean |
isSinglePointDomain(SampledSet ss)
See if the domain is a single point (only 1 x and y value). |
static boolean |
isTimeSequence(FieldImpl grid)
Check to see if this is a single grid or if it is a time sequence of grids. |
static boolean |
isVolume(FieldImpl grid)
Is the gievn field a volume. |
static void |
main(String[] args)
test |
static FieldImpl |
make2DGridFromSlice(FieldImpl slice)
Transform a 2D slice (3D grid with 2D manifold) into a 2D grid. |
static FieldImpl |
make2DGridFromSlice(FieldImpl slice,
boolean copy)
Transform a 2D slice (3D grid with 2D manifold) into a 2D grid. |
static MapProjection |
makeRadarMapProjection(CoordinateSystem radarCS)
Return a MapProjection that relates to the Radar*DCoordinateSystem. |
static String |
printModes(int samplingMode,
int errorMode)
Print out the sampling and error modes modes |
static FieldImpl |
resampleGrid(FieldImpl grid,
SampledSet subDomain)
Resample the grid at the positions defined by a SampledSet using the default methods and error propagation. |
static FieldImpl |
resampleGrid(FieldImpl grid,
SampledSet subDomain,
int samplingMode)
Resample the grid at the positions defined by a SampledSet using the method specified and default error propagation. |
static FieldImpl |
resampleGrid(FieldImpl grid,
SampledSet subDomain,
int samplingMode,
int errorMode)
Resample the grid at the positions defined by a SampledSet. |
static FieldImpl |
sample(FieldImpl grid,
EarthLocation location)
Sample the grid at the position defined by the EarthLocation |
static FieldImpl |
sample(FieldImpl grid,
EarthLocation location,
int samplingMode)
Sample the grid at the position defined by the EarthLocation with the VisAD resampling method given. |
static FieldImpl |
sample(FieldImpl grid,
LatLonPoint point)
Sample the grid at the position defined by the LatLonPoint |
static FieldImpl |
sample(FieldImpl grid,
LatLonPoint point,
int samplingMode)
Sample the grid at the position defined by the LatLonPoint |
static Real |
sampleToReal(FieldImpl grid,
EarthLocation el,
Real animationValue)
This samples the given grid in both time and space and trys to return a Real value |
static FieldImpl |
setParamType(FieldImpl grid,
RealType newParam)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
RealType newParam,
boolean copy)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
String newName)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
String[] newNames,
boolean copy)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
String newName,
boolean copy)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
TupleType newParam)
Set the range MathType of the lowest element. |
static FieldImpl |
setParamType(FieldImpl grid,
TupleType newParam,
boolean copy)
Set the range MathType of the lowest element. |
static FieldImpl |
setSpatialDomain(FieldImpl grid,
SampledSet newDomain)
Change the spatial domain of a grid using the new one. |
static FieldImpl |
setSpatialDomain(FieldImpl grid,
SampledSet newDomain,
boolean copy)
Change the spatial domain of a grid using the new one. |
static FieldImpl |
slice(FieldImpl grid,
SampledSet slice)
Slice the grid at the positions defined by a SampledSet. |
static FieldImpl |
slice(FieldImpl grid,
SampledSet slice,
int samplingMode)
Slice the grid at the positions defined by a SampledSet. |
static FieldImpl |
sliceAlongLatLonLine(FieldImpl grid,
LatLonPoint start,
LatLonPoint end)
Slice the grid along the line specified by the two LatLonPoint-s |
static FieldImpl |
sliceAlongLatLonLine(FieldImpl grid,
LatLonPoint start,
LatLonPoint end,
int samplingMode)
Slice the grid along the line specified by the two LatLonPoint-s |
static FieldImpl |
sliceAtLevel(FieldImpl grid,
double levelValue)
Slice the grid at the vertical level indictated. |
static FieldImpl |
sliceAtLevel(FieldImpl grid,
Real level)
Slice the grid at the vertical level indictated. |
static FieldImpl |
sliceAtLevel(FieldImpl grid,
Real level,
int samplingMode)
Slice the grid at the vertical level indictated. |
static FieldImpl |
subset(FieldImpl grid,
int skip)
Create a subset of the grid, skipping every nth point in the X and Y direction. |
static FieldImpl |
subset(FieldImpl grid,
int skipx,
int skipy)
Create a subset of the grid skipping every i'th x and j'th y point. |
static FieldImpl |
subset(FieldImpl grid,
int skipx,
int skipy,
int skipz)
Create a subset of the grid skipping every i'th x and j'th y point and k'th z point |
static void |
writeGridToXls(FieldImpl grid)
Write grid out to an Excel spreadsheet |
static void |
writeGridToXls(FieldImpl grid,
String filename)
Write grid out to an Excel spreadsheet |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SAMPLING_MODE
public static final int DEFAULT_ERROR_MODE
| Constructor Detail |
|---|
public GridUtil()
| Method Detail |
|---|
public static boolean isGrid(FieldImpl field)
field - fieldImpl to check
public static boolean isConstantSpatialDomain(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem getting Data object
public static SampledSet getSpatialDomain(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem getting domain set
public static SampledSet getSpatialDomain(FieldImpl grid,
int timeIndex)
throws VisADException
grid - grid to checktimeIndex - timestep to check
VisADException - problem getting domain set
public static FieldImpl setSpatialDomain(FieldImpl grid,
SampledSet newDomain)
throws VisADException
grid - grid to change.newDomain - Must have same length as current spatial domain of
grid
VisADException - wrong domain length or VisAD problem.
public static FieldImpl setSpatialDomain(FieldImpl grid,
SampledSet newDomain,
boolean copy)
throws VisADException
grid - grid to change.newDomain - Must have same length as current spatial domain of
gridcopy - copy values
VisADException - wrong domain length or VisAD problem.
public static boolean isSinglePointDomain(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem accessing grid
public static boolean isSinglePointDomain(SampledSet ss)
throws VisADException
ss - domain set of the grid
VisADException - problem accessing gridpublic static boolean isSequence(FieldImpl grid)
grid - grid to check
isTimeSequence(FieldImpl)
public static boolean isTimeSequence(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem determining this
public static Set getTimeSet(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem determining this
public static List getDateTimeList(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - problem determining this
public static boolean isNavigated(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - can't create VisAD object
public static boolean isNavigated(SampledSet spatialSet)
throws VisADException
spatialSet - spatial domain of grid to check
VisADException - can't create VisAD object
public static MapProjection getNavigation(FieldImpl grid)
throws VisADException
grid - grid to use
VisADException - no navigation or some other error
public static MapProjection getNavigation(SampledSet spatialSet)
throws VisADException
spatialSet - spatial set for grid
VisADException - no navigation or some other error
public static boolean isLatLonOrder(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - can't get at VisAD objects
public static boolean isLatLonOrder(SampledSet spatialSet)
throws VisADException
spatialSet - spatial domain of the grid
VisADException - can't get at VisAD objects
public static RealType getSequenceType(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - unable to get the informationisSequence(FieldImpl)
public static boolean is3D(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - unable to get the information
public static boolean isVolume(FieldImpl grid)
throws VisADException
grid - The grid
VisADException - On badness
public static Real sampleToReal(FieldImpl grid,
EarthLocation el,
Real animationValue)
throws VisADException,
RemoteException
grid - The gridel - LocationanimationValue - Time
RemoteException - On badness
VisADException - On badness
public static boolean is3D(SampledSet domainSet)
throws VisADException
domainSet - spatial domain of the grid
VisADException - unable to get the information
public static boolean is2D(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - unable to get the information
public static boolean is2D(SampledSet domainSet)
throws VisADException
domainSet - spatial domain to check
VisADException - unable to get the information
public static FieldImpl subset(FieldImpl grid,
int skip)
throws VisADException
grid - grid to subsetskip - x and y skip factor
VisADException - unable to subset the grid
public static FieldImpl subset(FieldImpl grid,
int skipx,
int skipy)
throws VisADException
grid - grid to subsampleskipx - x skip factorskipy - y skip factor
VisADException - unable to subsample grid
public static FieldImpl subset(FieldImpl grid,
int skipx,
int skipy,
int skipz)
throws VisADException
grid - grid to subsampleskipx - x skip factorskipy - y skip factorskipz - z skip factor
VisADException - unable to subsample grid
public static FieldImpl sliceAtLevel(FieldImpl grid,
Real level)
throws VisADException
grid - grid to slice (must be a valid 3D grid)level - level to slice at. level must have units
convertible with the vertial coordinate of the spatial
domain or it's reference if there is a CoordinateSystem
associated with the domain.
VisADException - problem in resampling
public static FieldImpl sliceAtLevel(FieldImpl grid,
Real level,
int samplingMode)
throws VisADException
grid - grid to slice (must be a valid 3D grid)level - level to slice at. level must have units
convertible with the vertial coordinate of the spatial
domain or it's reference if there is a CoordinateSystem
associated with the domain.samplingMode - Data.WEIGHTED_AVERAGE or Data.NEAREST_NEIGHBOR
VisADException - problem in resampling
public static boolean isAllMissing(FieldImpl field)
throws VisADException
field - fieldImpl to check
VisADException - unable to open VisAD object
public static boolean isAllMissing(FieldImpl grid,
boolean popupErrorMessage)
throws VisADException
grid - grid to checkpopupErrorMessage - pop up a JOptionDialog box is all are missing
VisADException - unable to open VisAD object
public static FieldImpl sliceAtLevel(FieldImpl grid,
double levelValue)
throws VisADException
grid - grid to slice (must be a valid 3D grid)levelValue - level value to slice at. Value is assumed
to be in the units of the vertical coordinate of the
spatial domain of the FieldImpl
VisADException - problem in resampling
public static FieldImpl getProfileAtLatLonPoint(FieldImpl grid,
LatLonPoint point)
throws VisADException
null if no such profile could be created.
grid - grid to slice (must be a valid 3D grid)point - LatLonPoint to sample at.
null. If this is a
sequence of grids it will be a sequence of the slices.
VisADException - problem in resampling
public static FieldImpl getProfileAtLatLonPoint(FieldImpl grid,
LatLonPoint point,
int samplingMode)
throws VisADException
null if no such profile could be created.
grid - grid to slice (must be a valid 3D grid)point - LatLonPoint to sample at.samplingMode - Data.WEIGHTED_AVERAGE or NEAREST_NEIGHBOR
null. If this is a
sequence of grids it will be a sequence of the slices.
VisADException - problem in resampling
public static FieldImpl sliceAlongLatLonLine(FieldImpl grid,
LatLonPoint start,
LatLonPoint end)
throws VisADException
grid - grid to slice (must be a valid 2D or 3D grid)start - starting LatLonPoint of the lineend - starting LatLonPoint of the line
VisADException - problem in resampling
public static FieldImpl sliceAlongLatLonLine(FieldImpl grid,
LatLonPoint start,
LatLonPoint end,
int samplingMode)
throws VisADException
grid - grid to slice (must be a valid 2D or 3D grid)start - starting LatLonPoint of the lineend - starting LatLonPoint of the linesamplingMode - mode for sampling
VisADException - problem in resampling
public static FieldImpl sample(FieldImpl grid,
EarthLocation location)
throws VisADException
grid - grid to sample (must be a valid 3D grid)location - EarthLocation to sample at.
VisADException - invalid point or some other problem
public static FieldImpl sample(FieldImpl grid,
EarthLocation location,
int samplingMode)
throws VisADException
grid - grid to sample (must be a valid 3D grid)location - EarthLocation to sample at.samplingMode - Data.WEIGHTED_AVERAGE or NEAREST_NEIGHBOR
VisADException - invalid point or some other problem
public static FieldImpl sample(FieldImpl grid,
LatLonPoint point)
throws VisADException
grid - grid to sample (must be a valid 3D grid)point - LatLonPoint to sample at.
VisADException - invalid point or some other problem
public static FieldImpl sample(FieldImpl grid,
LatLonPoint point,
int samplingMode)
throws VisADException
grid - grid to sample (must be a valid 3D grid)point - LatLonPoint to sample at.samplingMode - Data.WEIGHTED_AVERAGE or NEAREST_NEIGHBOR
VisADException - invalid point or some other problem
public static FieldImpl slice(FieldImpl grid,
SampledSet slice)
throws VisADException
grid - grid to slice (must be a valid 3D grid)slice - set of points to sample on. It must be compatible
with the spatial domain of the grid.
VisADException - invalid slice or some other problem
public static FieldImpl slice(FieldImpl grid,
SampledSet slice,
int samplingMode)
throws VisADException
grid - grid to slice (must be a valid 3D grid)slice - set of points to sample on. It must be compatible
with the spatial domain of the grid.samplingMode - Data.WEIGHTED_AVERAGE or NEAREST_NEIGHBOR
VisADException - invalid slice or some other problem
public static FieldImpl make2DGridFromSlice(FieldImpl slice)
throws VisADException
slice - slice to transform
VisADException - unable to create 2D slice
public static FieldImpl make2DGridFromSlice(FieldImpl slice,
boolean copy)
throws VisADException
slice - slice to transformcopy - true to copy data
VisADException - unable to create 2D slice
public static Unit[] getParamUnits(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - unable to get at data types
public static TupleType getParamType(FieldImpl grid)
throws VisADException
grid - grid to check
VisADException - unable to get at data types
public static FieldImpl getParam(FieldImpl grid,
int index)
throws VisADException
grid - grid to checkindex - parameter index
VisADException - unable to get at data types
public static FieldImpl getParam(FieldImpl grid,
int index,
boolean copy)
throws VisADException
grid - grid to checkindex - parameter indexcopy - true to make a copy
VisADException - unable to get at data types
public static FieldImpl setParamType(FieldImpl grid,
String newName)
throws VisADException
grid - grid to changenewName - name of new parameter
VisADException - problem setting new parameter
public static FieldImpl setParamType(FieldImpl grid,
String newName,
boolean copy)
throws VisADException
grid - grid to changenewName - name of new parametercopy - true to make a copy
VisADException - problem setting new parameter
public static FieldImpl setParamType(FieldImpl grid,
String[] newNames,
boolean copy)
throws VisADException
grid - grid to changenewNames - names of new parameterscopy - true to make a copy
VisADException - problem setting new parameter
public static FieldImpl setParamType(FieldImpl grid,