001/*
002 * This file is part of McIDAS-V
003 *
004 * Copyright 2007-2024
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.HashMap;
032import java.util.Map;
033
034public class CrIS_SDR_Spectrum extends SpectrumAdapter {
035
036  public static int[] ifov_order = new int[] {8,5,2,7,4,1,6,3,0};
037
038  public HashMap new_subset = new HashMap();
039  
040  private float initialSpectralResolution = 0f;
041  private float spectralIncrement = 0f;
042  
043  // Pick a wavelength for the preview where there is likely to be a decent visual slice
044  private static final float DEFAULT_PREVIEW_WAVENUMBER = 902.25f;
045
046  public CrIS_SDR_Spectrum(MultiDimensionReader reader, Map<String, Object> metadata) {
047    super(reader, metadata);
048  }
049  
050  public int computeNumChannels() {
051          
052     String arrayName = (String) metadata.get("array_name");
053     int numChannels = CrIS_SDR_Utility.getNumChannels(arrayName);
054     initialSpectralResolution = CrIS_SDR_Utility.getWavenumberStart(arrayName);
055     spectralIncrement = CrIS_SDR_Utility.getWavenumberIncrement(arrayName);
056          
057     return numChannels;
058  }
059
060  public float[] getChannels() throws Exception {
061    float[] spectrum = new float[numChannels];
062    for (int k=0; k < numChannels; k++) {
063       spectrum[k] = initialSpectralResolution + k * (spectralIncrement);
064    }
065    return spectrum;
066  }
067  
068        public float getInitialWavenumber() {
069                return DEFAULT_PREVIEW_WAVENUMBER;
070        }
071
072}