001 /*
002 * $Id: AddePointDataSource.java,v 1.4 2012/02/19 17:35:40 davep Exp $
003 *
004 * This file is part of McIDAS-V
005 *
006 * Copyright 2007-2012
007 * Space Science and Engineering Center (SSEC)
008 * University of Wisconsin - Madison
009 * 1225 W. Dayton Street, Madison, WI 53706, USA
010 * https://www.ssec.wisc.edu/mcidas
011 *
012 * All Rights Reserved
013 *
014 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
015 * some McIDAS-V source code is based on IDV and VisAD source code.
016 *
017 * McIDAS-V is free software; you can redistribute it and/or modify
018 * it under the terms of the GNU Lesser Public License as published by
019 * the Free Software Foundation; either version 3 of the License, or
020 * (at your option) any later version.
021 *
022 * McIDAS-V is distributed in the hope that it will be useful,
023 * but WITHOUT ANY WARRANTY; without even the implied warranty of
024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
025 * GNU Lesser Public License for more details.
026 *
027 * You should have received a copy of the GNU Lesser Public License
028 * along with this program. If not, see http://www.gnu.org/licenses.
029 */
030
031 package edu.wisc.ssec.mcidasv.data.adde;
032
033
034 import java.util.ArrayList;
035 import java.util.Hashtable;
036 import java.util.List;
037
038 import ucar.unidata.data.AddeUtil;
039 import ucar.unidata.data.DataChoice;
040 import ucar.unidata.data.DataSelection;
041 import ucar.unidata.data.DataSourceDescriptor;
042 import ucar.unidata.data.point.PointObFactory;
043 import ucar.unidata.util.LogUtil;
044 import ucar.unidata.util.Misc;
045 import ucar.unidata.util.Trace;
046 import ucar.unidata.util.TwoFacedObject;
047
048 import visad.*;
049 import visad.data.mcidas.PointDataAdapter;
050 import ucar.unidata.geoloc.LatLonPoint;
051 import ucar.unidata.geoloc.LatLonRect;
052 import edu.wisc.ssec.mcidas.adde.AddePointURL;
053 import ucar.visad.quantities.CommonUnits;
054
055
056 /**
057 * A data source for ADDE point data
058 *
059 * @author Don Murray
060 * @version $Revision: 1.4 $ $Date: 2012/02/19 17:35:40 $
061 */
062 public class AddePointDataSource extends ucar.unidata.data.point.AddePointDataSource {
063
064 /** list of levels names */
065 private static String[] levelNames = {
066 "SFC", "1000", "925", "850", "700", "500", "400", "300", "250", "200",
067 "150", "100", "70", "50", "30", "20", "10"
068 };
069
070 /** list of level values */
071 private static int[] levelValues = {
072 1001, 1000, 925, 850, 700, 500, 400, 300, 250, 200,
073 150, 100, 70, 50, 30, 20, 10
074 };
075
076 /**
077 * Default constructor.
078 *
079 * @throws VisADException
080 */
081 public AddePointDataSource() throws VisADException {
082 super();
083 }
084
085 /**
086 * Create a new <code>AddePointDataSource</code> from the parameters
087 * supplied.
088 *
089 * @param descriptor <code>DataSourceDescriptor</code> for this.
090 * @param source Source URL
091 * @param properties <code>Hashtable</code> of properties for the source.
092 *
093 * @throws VisADException couldn't create the VisAD data
094 */
095 public AddePointDataSource(DataSourceDescriptor descriptor,
096 String source, Hashtable properties)
097 throws VisADException {
098 super(descriptor, source, properties);
099 }
100
101 /**
102 * Get the list of all levels available from this DataSource
103 *
104 *
105 * @param dataChoice The data choice we are getting levels for
106 * @return List of all available levels
107 */
108 public List getAllLevels(DataChoice dataChoice, DataSelection dataSelection) {
109 return getLevels();
110 }
111
112 /**
113 * Get the levels property
114 * @return levels;
115 */
116 private List getLevels() {
117 List levels = new ArrayList();
118 try {
119 for (int i = 0; i < levelValues.length; i++) {
120 levels.add(new TwoFacedObject(levelNames[i],
121 new Real(RealType.getRealType("Pressure",
122 CommonUnits.MILLIBAR), levelValues[i],
123 CommonUnits.MILLIBAR)));
124 }
125 } catch (VisADException ve) {}
126 return levels;
127 }
128
129 }
130