001 /* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2013 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 029 package edu.wisc.ssec.mcidasv.data.adde.sgp4; 030 031 /** 032 * 033 * @author Shawn 034 */ 035 public class Sidereal 036 { 037 038 /** 039 * Calculates the Greenwich mean sidereal time (GMST) on julDate (doesn't have to be 0h). 040 * Used calculations from Meesus 2nd ed. 041 * @param mjd Modified Julian Date 042 * @return Greenwich mean sidereal time in degrees (0-360) 043 */ 044 public static double Greenwich_Mean_Sidereal_Deg(double mjd) 045 { 046 // calculate T 047 double T = (mjd-51544.5)/36525.0; 048 049 // do calculation 050 double gmst = ( (280.46061837 + 360.98564736629*(mjd-51544.5)) + 0.000387933*T*T - T*T*T/38710000.0) % 360.0; 051 052 // make positive 053 if(gmst < 0) 054 { 055 gmst += 360.0; 056 } 057 058 return gmst; 059 } //Greenwich_Mean_Sidereal_Deg 060 061 /** 062 * Calculates the mean sidereal time (MST) on julDate (doesn't have to be 0h) for a given longitiude. 063 * @param mjd Modified Julian Date 064 * @param longitude longitude in degrees 065 * @return mean sidereal time in degrees (0-360) 066 */ 067 public static double Mean_Sidereal_Deg(double mjd, double longitudeDeg) 068 { 069 return (Greenwich_Mean_Sidereal_Deg(mjd) + longitudeDeg) % 360.0; 070 } // Mean_Sidereal_Deg 071 072 073 // main testing function 074 public static void main(String[] args) 075 { 076 double mjd = 2449991.875 - AstroConst.JDminusMJD; 077 double longitude = -75; // degrees 078 double latitude = 40; 079 080 double mst = Sidereal.Mean_Sidereal_Deg(mjd, longitude); 081 082 System.out.println("For Phily MST: " + mst); 083 084 // assuming a spherical Earth - calculate ECI vector 085 double [] eciVec = new double[3]; 086 eciVec[2] = AstroConst.R_Earth * Math.sin( latitude*Math.PI/180.0 ); 087 double r = AstroConst.R_Earth * Math.cos( latitude*Math.PI/180.0 ); 088 eciVec[0] = r * Math.cos(mst*Math.PI/180.0); 089 eciVec[1] = r * Math.sin(mst*Math.PI/180.0); 090 091 System.out.println("ECI: " + eciVec[0] + ", " + eciVec[1] + ", " + eciVec[2]); 092 } 093 094 }