001/* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2016 005 * Space Science and Engineering Center (SSEC) 006 * University of Wisconsin - Madison 007 * 1225 W. Dayton Street, Madison, WI 53706, USA 008 * https://www.ssec.wisc.edu/mcidas 009 * 010 * All Rights Reserved 011 * 012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and 013 * some McIDAS-V source code is based on IDV and VisAD source code. 014 * 015 * McIDAS-V is free software; you can redistribute it and/or modify 016 * it under the terms of the GNU Lesser Public License as published by 017 * the Free Software Foundation; either version 3 of the License, or 018 * (at your option) any later version. 019 * 020 * McIDAS-V is distributed in the hope that it will be useful, 021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 023 * GNU Lesser Public License for more details. 024 * 025 * You should have received a copy of the GNU Lesser Public License 026 * along with this program. If not, see http://www.gnu.org/licenses. 027 */ 028 029package edu.wisc.ssec.mcidasv.data.hydra; 030 031import visad.Data; 032import visad.FlatField; 033import visad.Set; 034import visad.CoordinateSystem; 035import visad.RealType; 036import visad.RealTupleType; 037import visad.SetType; 038import visad.Linear2DSet; 039import visad.Unit; 040import visad.FunctionType; 041import visad.VisADException; 042import java.rmi.RemoteException; 043 044import java.util.Hashtable; 045import java.util.HashMap; 046import java.util.Map; 047import java.util.StringTokenizer; 048 049import java.io.BufferedReader; 050import java.io.FileInputStream; 051import java.io.IOException; 052import java.io.InputStream; 053import java.io.InputStreamReader; 054 055 056public class HSRL2D extends ProfileAlongTrack { 057 058 public HSRL2D() { 059 } 060 061 public HSRL2D(MultiDimensionReader reader, Map<String, Object> metadata) { 062 super(reader, metadata); 063 } 064 065 public float[] getVertBinAltitude() throws Exception { 066 float[] altitude = new float[VertLen]; 067 for (int k=0; k<VertLen; k++) { 068 altitude[k] = -300 + k*15f; 069 } 070 return altitude; 071 } 072 073 public float[] getTrackTimes() throws Exception { 074 return null; 075 } 076 077 public RealType makeVertLocType() throws Exception { 078 return RealType.Altitude; 079 } 080 081 public RealType makeTrackTimeType() throws Exception { 082 return null; 083 } 084 085 public float[] getTrackLongitude() throws Exception { 086 int[] start = new int[] {0,0}; 087 int[] count = new int[] {TrackLen,1}; 088 int[] stride = new int[] {1,1}; 089 double[] dvals = reader.getDoubleArray((String)metadata.get(longitude_name), start, count, stride); 090 float[] vals = new float[dvals.length]; 091 for (int i=0; i<vals.length;i++) vals[i] = (float)dvals[i]; 092 return vals; 093 } 094 095 public float[] getTrackLatitude() throws Exception { 096 int[] start = new int[] {0,0}; 097 int[] count = new int[] {TrackLen,1}; 098 int[] stride = new int[] {1,1}; 099 double[] dvals = reader.getDoubleArray((String)metadata.get(latitude_name), start, count, stride); 100 float[] vals = new float[dvals.length]; 101 for (int i=0; i<vals.length;i++) vals[i] = (float)dvals[i]; 102 return vals; 103 } 104 105 public Map<String, double[]> getDefaultSubset() { 106 Map<String, double[]> subset = ProfileAlongTrack.getEmptySubset(); 107 108 double[] coords = subset.get("TrackDim"); 109 coords[0] = 0.0; 110 coords[1] = (TrackLen) - 1; 111 coords[2] = 5.0; 112 subset.put("TrackDim", coords); 113 114 coords = subset.get("VertDim"); 115 coords[0] = 0.0; 116 coords[1] = (VertLen) - 1; 117 coords[2] = 2.0; 118 subset.put("VertDim", coords); 119 return subset; 120 } 121 122}