001/* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2025 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 https://www.gnu.org/licenses/. 027 */ 028 029package edu.wisc.ssec.mcidasv.data.hydra; 030 031import java.util.Map; 032 033import visad.RealType; 034 035public class HSRL2D extends ProfileAlongTrack { 036 037 public HSRL2D() { 038 } 039 040 public HSRL2D(MultiDimensionReader reader, Map<String, Object> metadata) { 041 super(reader, metadata); 042 } 043 044 public float[] getVertBinAltitude() throws Exception { 045 float[] altitude = new float[VertLen]; 046 for (int k=0; k<VertLen; k++) { 047 altitude[k] = -300 + k*15f; 048 } 049 return altitude; 050 } 051 052 public float[] getTrackTimes() throws Exception { 053 return null; 054 } 055 056 public RealType makeVertLocType() throws Exception { 057 return RealType.Altitude; 058 } 059 060 public RealType makeTrackTimeType() throws Exception { 061 return null; 062 } 063 064 public float[] getTrackLongitude() throws Exception { 065 int[] start = new int[] {0,0}; 066 int[] count = new int[] {TrackLen,1}; 067 int[] stride = new int[] {1,1}; 068 double[] dvals = reader.getDoubleArray((String)metadata.get(longitude_name), start, count, stride); 069 float[] vals = new float[dvals.length]; 070 for (int i=0; i<vals.length;i++) vals[i] = (float)dvals[i]; 071 return vals; 072 } 073 074 public float[] getTrackLatitude() throws Exception { 075 int[] start = new int[] {0,0}; 076 int[] count = new int[] {TrackLen,1}; 077 int[] stride = new int[] {1,1}; 078 double[] dvals = reader.getDoubleArray((String)metadata.get(latitude_name), start, count, stride); 079 float[] vals = new float[dvals.length]; 080 for (int i=0; i<vals.length;i++) vals[i] = (float)dvals[i]; 081 return vals; 082 } 083 084 public Map<String, double[]> getDefaultSubset() { 085 Map<String, double[]> subset = ProfileAlongTrack.getEmptySubset(); 086 087 double[] coords = subset.get("TrackDim"); 088 coords[0] = 0.0; 089 coords[1] = TrackLen - 1; 090 coords[2] = 5.0; 091 subset.put("TrackDim", coords); 092 093 coords = subset.get("VertDim"); 094 coords[0] = 0.0; 095 coords[1] = VertLen - 1; 096 coords[2] = 2.0; 097 subset.put("VertDim", coords); 098 return subset; 099 } 100 101}