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 visad.Gridded2DSet;
032import visad.RealTupleType;
033
034public class CrIS_SDR_LonLatNavigation extends SwathNavigation  {
035
036  private Gridded2DSet gset = null;
037
038  public CrIS_SDR_LonLatNavigation(SwathAdapter swathAdapter) throws Exception {
039    super(swathAdapter);
040  }
041
042  Gridded2DSet createInterpSet() throws Exception {
043
044    int[] new_geo_start = new int[3]; 
045    int[] new_geo_count = new int[3]; 
046    int[] new_geo_stride = new int[3]; 
047
048    new_geo_start[geo_xtrack_idx] = 0;
049    new_geo_count[geo_xtrack_idx] = 30;
050    new_geo_stride[geo_xtrack_idx] = 1;
051    new_geo_start[geo_track_idx] = 0;
052    new_geo_count[geo_track_idx] = geo_count[geo_track_idx];
053    new_geo_stride[geo_track_idx] = 1;
054    new_geo_start[2] = 0;
055    new_geo_count[2] = 9;
056    new_geo_stride[2] = 1;
057
058    float[] lons = reader.getFloatArray(lon_array_name, new_geo_start, new_geo_count, new_geo_stride);
059    float[] lats = reader.getFloatArray(lat_array_name, new_geo_start, new_geo_count, new_geo_stride);
060
061    gset = new Gridded2DSet(RealTupleType.SpatialEarth2DTuple,
062                   new float[][] {lons, lats},
063                        geo_count[idx_order[0]], geo_count[idx_order[1]],
064                            null, null, null, false, false);
065    return gset;
066  }
067
068  public Gridded2DSet getInterpSet() {
069    return gset;
070  }
071}