Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MUG
visad
Commits
14480e21
Commit
14480e21
authored
Oct 07, 2018
by
rink
Browse files
A consistency check is not supported. Non-degenerate grids are trusted.
Enhance the documentation a bit.
parent
d23b9ac5
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/src/visad/GriddedLatLonSet.java
View file @
14480e21
...
...
@@ -29,8 +29,13 @@ package visad;
import
java.io.*
;
/**
GriddedLatLonSet represents a finite set of samples of R^2.<P>
*/
*
* @author rink
*
* GriddedLatLonSet represents a finite set of samples with a 2D grid topology on the surface
* of the Earth mapped to R^2: (Longitude, Latitude) or (Latitude, Longitude). This class
* exists primarily to override valueToGrid and gridToValue.
*/
public
class
GriddedLatLonSet
extends
Gridded2DSet
{
int
LengthX
,
LengthY
,
TrackLen
,
latI
,
lonI
;
...
...
@@ -46,7 +51,7 @@ public class GriddedLatLonSet extends Gridded2DSet {
null errors, CoordinateSystem and Units are defaults from type */
public
GriddedLatLonSet
(
MathType
type
,
float
[][]
samples
,
int
lengthX
,
int
lengthY
)
throws
VisADException
{
this
(
type
,
samples
,
lengthX
,
lengthY
,
null
,
null
,
null
,
false
,
false
);
this
(
type
,
samples
,
lengthX
,
lengthY
,
null
,
null
,
null
,
false
);
}
/** a 2-D set whose topology is a lengthX x lengthY grid;
...
...
@@ -59,23 +64,14 @@ public class GriddedLatLonSet extends Gridded2DSet {
public
GriddedLatLonSet
(
MathType
type
,
float
[][]
samples
,
int
lengthX
,
int
lengthY
,
CoordinateSystem
coord_sys
,
Unit
[]
units
,
ErrorEstimate
[]
errors
)
throws
VisADException
{
this
(
type
,
samples
,
lengthX
,
lengthY
,
coord_sys
,
units
,
errors
,
true
,
true
);
this
(
type
,
samples
,
lengthX
,
lengthY
,
coord_sys
,
units
,
errors
,
false
);
}
public
GriddedLatLonSet
(
MathType
type
,
float
[][]
samples
,
int
lengthX
,
int
lengthY
,
CoordinateSystem
coord_sys
,
Unit
[]
units
,
ErrorEstimate
[]
errors
,
boolean
copy
)
throws
VisADException
{
this
(
type
,
samples
,
lengthX
,
lengthY
,
coord_sys
,
units
,
errors
,
copy
,
true
);
}
public
GriddedLatLonSet
(
MathType
type
,
float
[][]
samples
,
int
lengthX
,
int
lengthY
,
CoordinateSystem
coord_sys
,
Unit
[]
units
,
ErrorEstimate
[]
errors
,
boolean
copy
,
boolean
test
)
throws
VisADException
{
super
(
type
,
samples
,
lengthX
,
lengthY
,
coord_sys
,
units
,
errors
,
copy
,
test
);
super
(
type
,
samples
,
lengthX
,
lengthY
,
coord_sys
,
units
,
errors
,
copy
,
false
);
LowX
=
Low
[
0
];
HiX
=
Hi
[
0
];
...
...
@@ -136,15 +132,17 @@ public class GriddedLatLonSet extends Gridded2DSet {
System
.
arraycopy
(
lons
,
lons0
.
length
,
lons1
,
0
,
lons1
.
length
);
System
.
arraycopy
(
lats
,
lats0
.
length
,
lats1
,
0
,
lats1
.
length
);
granules
[
0
]
=
new
GriddedLatLonSet
(
type
,
new
float
[][]
{
lons0
,
lats0
},
LengthX
,
TrackLen0
,
coord_sys
,
units
,
errors
,
copy
,
test
);
granules
[
1
]
=
new
GriddedLatLonSet
(
type
,
new
float
[][]
{
lons1
,
lats1
},
LengthX
,
TrackLen1
,
coord_sys
,
units
,
errors
,
copy
,
test
);
granules
[
0
]
=
new
GriddedLatLonSet
(
type
,
new
float
[][]
{
lons0
,
lats0
},
LengthX
,
TrackLen0
,
coord_sys
,
units
,
errors
,
copy
);
granules
[
1
]
=
new
GriddedLatLonSet
(
type
,
new
float
[][]
{
lons1
,
lats1
},
LengthX
,
TrackLen1
,
coord_sys
,
units
,
errors
,
copy
);
}
}
/** transform an array of non-integer grid coordinates to an array
of values in R^DomainDimension */
/** transform an array of non-integer grid coordinates to an array of values in (Longitude, Latitude).
* Returns nearest neighbor if the cell which contains the grid coordinate straddles
* the dateline or prime meridian.
*/
public
float
[][]
gridToValue
(
float
[][]
grid
)
throws
VisADException
{
if
(
grid
.
length
!=
ManifoldDimension
)
{
throw
new
SetException
(
"Gridded2DSet.gridToValue: grid dimension "
+
...
...
@@ -258,6 +256,16 @@ public class GriddedLatLonSet extends Gridded2DSet {
return
valueToGrid
(
value
,
null
);
}
/** transform an array of values in R^2 (Longitude, Latitude) to an array
* of non-integer grid coordinates by walking the grid from guess to incoming
* target values by minimizing the angle between vectors from Earth center to the
* their respective Earth coordinates.
* @param value (Longitude, Latitude)
* @param guess Integer grid coordinate. Is replaced by last valid grid located
* the search. If null, center points of domain is used as guess.
* @return Fractional grid coordinates for incoming values
* @throws visad.VisADException
*/
@Override
public
synchronized
float
[][]
valueToGrid
(
float
[][]
value
,
int
[]
guess
)
throws
VisADException
{
...
...
core/src/visad/XTrackScanLatLonSet.java
View file @
14480e21
...
...
@@ -31,9 +31,10 @@ package visad;
* @author rink
*
* Specialized extension to GriddedLatLonSet for a contiguous collection of spatially overlapping sets
* wherein samples of an individual set are spatially coherent (
they pass the consistency test
: no bow-ties).
* wherein
it's trusted that
samples of an individual set are spatially coherent (
non-degenerative
: no bow-ties).
* Examples are MODIS and VIIRS whose granules are comprised of multiple scans, each with a fixed number of
* detectors, and perpendicular to the polar orbit track. Its primary purpose is to override valueToGrid.
* detectors, and perpendicular to the polar orbit track, but may overlap when navigated to the Earth's surface.
* The primary purpose of this class is to override valueToGrid.
*
*/
public
class
XTrackScanLatLonSet
extends
GriddedLatLonSet
{
...
...
@@ -45,7 +46,7 @@ public class XTrackScanLatLonSet extends GriddedLatLonSet {
int
lastSetIdx
;
public
XTrackScanLatLonSet
(
MathType
type
,
float
[][]
samples
,
int
XTrackLen
,
int
TrackLen
,
int
linesPerScan
)
throws
VisADException
{
super
(
type
,
samples
,
XTrackLen
,
TrackLen
,
null
,
null
,
null
,
false
,
false
);
super
(
type
,
samples
,
XTrackLen
,
TrackLen
,
null
,
null
,
null
,
false
);
if
((
TrackLen
%
linesPerScan
)
!=
0
)
{
throw
new
VisADException
(
"There must be an intergral number of scans with detectorsPerScan: "
+
linesPerScan
+
" per "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment