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 */ 028package edu.wisc.ssec.mcidasv.data.hydra; 029 030import java.util.Map; 031 032import org.slf4j.Logger; 033import org.slf4j.LoggerFactory; 034 035/** 036 * 037 * 038 */ 039public class RadianceToBTbyLUT extends RangeProcessor { 040 041 private static final Logger logger = 042 LoggerFactory.getLogger(RadianceToBTbyLUT.class); 043 044 LUTtransform lutCal; 045 046 047 public RadianceToBTbyLUT(NetCDFFile reader, Map<String, Object> metadata, String radLUTname, String btLUTname) throws Exception { 048 super(reader, metadata); 049 050 int numLUTvals = (reader.getDimensionLengths(radLUTname))[0]; 051 float[] radLUT = reader.getFloatArray(radLUTname, new int[] {0}, new int[] {numLUTvals}, new int[] {1}); 052 float[] btLUT = reader.getFloatArray(btLUTname, new int[] {0}, new int[] {numLUTvals}, new int[] {1}); 053 054 lutCal = new LUTtransform(radLUT, btLUT); 055 } 056 057 public RadianceToBTbyLUT(NetCDFFile reader, Map<String, Object> metadata) throws Exception { 058 super(reader, metadata); 059 } 060 061 /** 062 * calls super to unscale radiances then converts to BT 063 * 064 */ 065 public float[] processRange(short[] values, Map<String, double[]> subset) { 066 float[] radiances = super.processRange(values, subset); 067 068 float[] brightnessTemps = null; 069 070 try { 071 brightnessTemps = lutCal.radianceToBrightnessTemp(radiances); 072 } catch (Exception e) { 073 logger.error("Problem processing range", e); 074 } 075 076 return brightnessTemps; 077 } 078}