//
// Radar3DCoordinateSystem.java
//

/*
VisAD system for interactive analysis and visualization of numerical
data.  Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/

package visad.bom;

import visad.*;
import visad.georef.*;

/**
   Radar3DCoordinateSystem is the VisAD CoordinateSystem class
   for radar (range, azimuth, elevation_angle) with an Earth
   (Latitude, Longitude, Altitude) Reference, and with
   azimuth and elevation angle in degrees, and range in meters.

*/ public class Radar3DCoordinateSystem extends NavigatedCoordinateSystem { public static final double EARTH_RADIUS = ShadowType.METERS_PER_DEGREE * Data.RADIANS_TO_DEGREES; private static Unit[] coordinate_system_units = {CommonUnit.meter, CommonUnit.degree, CommonUnit.degree}; private float centlat, centlon, centalt; private float radlow, radres, azlow, azres, elevlow, elevres; private double coscentlat, lonscale, latscale; /** * construct a CoordinateSystem for (range, azimuth, elevation_angle) * relative to an Earth (Latitude, Longitude, Altitude) Reference; * this constructor supplies units = * {CommonUnit.meter, CommonUnit.degree, CommonUnit.degree} * to the super constructor, in order to ensure Unit * compatibility with its use of trigonometric functions. Values * of range, azimuth, and elevation angle are in terms of absolute values of * range, azimuth and elevation angle (tilt) from the center point where * range is in meters, azimuth = 0 at north and elevation angle is in * degrees. * * @param clat latitude of center point * @param clon longitude of center point * @param calt altitude (meters) of center point * * @throws VisADException necessary VisAD object couldn't be created. */ public Radar3DCoordinateSystem(float clat, float clon, float calt) throws VisADException { this(new RealTupleType( RealType.Latitude, RealType.Longitude, RealType.Altitude), clat, clon, calt, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); } /** * construct a CoordinateSystem for (range, azimuth, elevation_angle) * relative to an Earth (Latitude, Longitude, Altitude) Reference; * this constructor supplies units = * {CommonUnit.meter, CommonUnit.degree, CommonUnit.degree} * to the super constructor, in order to ensure Unit * compatibility with its use of trigonometric functions. Values * of range, azimuth and elevation angle are in terms of multiples of range, * azimuth and elevation angle resolutions away from the low values * (radl, azl, elevl). The absolute range is (radl + range_value * radr) * the absolute azimuth is (azl + azimuth_value * azr) with azimuth = 0 at * north and the absolute elevation angle is * (elevl + elevation_angle_value * elevr). This allows the use of * Integer3DSets for the values assuming linear spacing of range, azimuth * and elevation angle. * * @param clat latitude of center point * @param clon longitude of center point * @param radl distance from center point for first possible echo * (meters) * @param radr distance between subsequent range increments (meters) * @param azl starting azimuth (degrees) * @param azr resolution of degrees between azimuths. * @param elevl starting elevation angle (tilt) (degrees) * @param elevr resolution of degrees between elevation angles. * * @throws VisADException necessary VisAD object couldn't be created. */ public Radar3DCoordinateSystem(float clat, float clon, float calt, float radl, float radr, float azl, float azr, float elevl, float elevr) throws VisADException { this(new RealTupleType( RealType.Latitude, RealType.Longitude, RealType.Altitude), clat, clon, calt, radl, radr, azl, azr, elevl, elevr); } /** * construct a CoordinateSystem for (range, azimuth, elevation_angle) * relative to an Earth (Latitude, Longitude, Altitude) Reference; * this constructor supplies units = * {CommonUnit.meter, CommonUnit.degree, CommonUnit.degree} * to the super constructor, in order to ensure Unit * compatibility with its use of trigonometric functions. Values * of range, azimuth and elevation angle are in terms of multiples of range, * azimuth and elevation angle resolutions away from the low values * (radl, azl, elevl). The absolute range is (radl + range_value * radr) * the absolute azimuth is (azl + azimuth_value * azr) with azimuth = 0 at * north and the absolute elevation angle is * (elevl + elevation_angle_value*elevr). This allows the use of * Integer3DSets for the values assuming linear spacing of range, azimuth * and elevation angle. * * @deprecated use constructors with station altitude to get a true * altitude above sea level. * @param reference reference RealTupleType * (should be Latitude, Longitude, Altitude) * @param clat latitude of center point * @param clon longitude of center point * @param radl distance from center point for first possible echo * (meters) * @param radr distance between subsequent range values (meters) * @param azl starting azimuth (degrees) * @param azr resolution of degrees between azimuths. * @param elevl starting elevation angle (tilt) (degrees) * @param elevr resolution of degrees between elevation angles. * * @throws VisADException necessary VisAD object couldn't be created. */ public Radar3DCoordinateSystem(RealTupleType reference, float clat, float clon, float radl, float radr, float azl, float azr, float elevl, float elevr) throws VisADException { this(reference, clat, clon, 0.0f, radl, radr, azl, azr, elevl, elevr); } /** * construct a CoordinateSystem for (range, azimuth, elevation_angle) * relative to an Earth (Latitude, Longitude, Altitude) Reference; * this constructor supplies units = * {CommonUnit.meter, CommonUnit.degree, CommonUnit.degree} * to the super constructor, in order to ensure Unit * compatibility with its use of trigonometric functions. Values * of range, azimuth and elevation angle are in terms of multiples of range, * azimuth and elevation angle resolutions away from the low values * (radl, azl, elevl). The absolute range is (radl + range_value * radr) * the absolute azimuth is (azl + azimuth_value * azr) with azimuth = 0 at * north and the absolute elevation angle is * (elevl + elevation_angle_value*elevr). This allows the use of * Integer3DSets for the values assuming linear spacing of range, azimuth * and elevation angle. * * @param reference reference RealTupleType * (should be Latitude, Longitude, Altitude) * @param clat latitude of center point * @param clon longitude of center point * @param calt altitude (meters) of center point * @param radl distance from center point for first possible echo * (meters) * @param radr distance between subsequent range values (meters) * @param azl starting azimuth (degrees) * @param azr resolution of degrees between azimuths. * @param elevl starting elevation angle (tilt) (degrees) * @param elevr resolution of degrees between elevation angles. * * @throws VisADException necessary VisAD object couldn't be created. */ public Radar3DCoordinateSystem(RealTupleType reference, float clat, float clon, float calt, float radl, float radr, float azl, float azr, float elevl, float elevr) throws VisADException { super(reference, coordinate_system_units); centlat = clat; centlon = clon; centalt = calt; radlow = radl; radres = radr; azlow = azl; azres = azr; elevlow = elevl; elevres = elevr; coscentlat = Math.cos(Data.DEGREES_TO_RADIANS * centlat); lonscale = ShadowType.METERS_PER_DEGREE * coscentlat; latscale = ShadowType.METERS_PER_DEGREE; // System.out.println("lonscale = " + lonscale + " latscale = " + latscale); } /** * Convert from range/azimuth/elevation to latitude/longitude/altitude. * Values input are in terms of multiples of the value resolution * from the low value (ex: low + value * resolution). Returned Altitude * is in meters above the station elevation if this was constructed * without the calt parameter. * * @param tuples range/azimuth/elevation values * @return lat/lon/altitude values * * @throws VisADException tuples is null or wrong dimension */ public double[][] toReference(double[][] tuples) throws VisADException { if (tuples == null || tuples.length != 3) { throw new CoordinateSystemException("Radar3DCoordinateSystem." + "toReference: tuples wrong dimension"); } int len = tuples[0].length; // System.out.println("toReference double len = " + len); // double[][] value = new double[3][len]; double[][] value = tuples; /* WLH 7 April 2000 for (int i=0; i

Ads help maintain this website.