001/*
002 * This file is part of McIDAS-V
003 *
004 * Copyright 2007-2023
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 java.util.HashMap;
032import java.util.Map;
033
034import visad.FlatField;
035import visad.Set;
036
037public class IASI_L1C_SwathAdapter extends SwathAdapter {
038
039   public IASI_L1C_SwathAdapter() {
040   }
041
042   public IASI_L1C_SwathAdapter(MultiDimensionReader reader, Map<String, Object> metadata) {
043     super(reader, metadata);
044   }
045
046   protected void setLengths() {
047     int len = getTrackLength();
048     setTrackLength(len *= 2);
049     len = getXTrackLength();
050     setXTrackLength( len /= 2);
051   }
052
053   public FlatField getData(Map<String, double[]> subset) throws Exception {
054     Set domainSet = makeDomain(subset);
055
056     Map<String, double[]> new_subset = new HashMap<>(subset);
057
058     double[] coords = new_subset.get(SwathAdapter.track_name);
059     double[] new_coords = new double[] {0.0, coords[1]/2, 1.0};
060
061     new_subset.put(SwathAdapter.track_name, new_coords);
062     new_coords = new double[] {0.0, 119.0, 1.0};
063     new_subset.put(SwathAdapter.xtrack_name, new_coords);
064
065     return makeFlatField(domainSet, new_subset);
066   }
067}