Merge "Issue #2259 Restore WxMath functionality used by popup skewT. Change-Id: Ibfb2d2fda05ad0f03d8e708e18d2b93b4914e7d2" into development
Former-commit-id:11b8e58e5e
[formerlya35702416d
] [formerlyc0cfb82bc3
[formerly 677bff1ebfe40da1987ad9fe868073884a9856ba]] Former-commit-id:c0cfb82bc3
Former-commit-id:186c5fe688
This commit is contained in:
commit
a679ac0200
5 changed files with 154 additions and 3 deletions
|
@ -4,10 +4,14 @@ Bundle-Name: Sounding Plug-in
|
|||
Bundle-SymbolicName: com.raytheon.uf.common.sounding
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.raytheon.uf.common.pointdata;bundle-version="1.11.31",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.11.31",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
|
||||
com.raytheon.edex.meteolib;bundle-version="1.12.1174",
|
||||
javax.measure;bundle-version="1.0.0"
|
||||
Export-Package: com.raytheon.uf.common.sounding,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
com.raytheon.uf.common.sounding.util.SoundingPrefs
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.common.sounding;
|
||||
|
||||
import com.raytheon.edex.meteoLib.Controller;
|
||||
import com.raytheon.uf.common.sounding.util.SoundingPrefs;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -33,9 +34,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 06 Nov 2006 jkorman Initial Coding
|
||||
* 29 Sept 2008 dhladky Added more stuff to finish SkewT.
|
||||
* 25 Jul 2013 2190 mschenke Moved common sounding calculation from
|
||||
* PopupSkewTDialog to here
|
||||
* Aug 20, 2013 2259 bsteffen Delete old skewt plugin.
|
||||
* 25 Jul 2013 2190 mschenke Moved common sounding calculation
|
||||
* from PopupSkewTDialog to here
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -205,6 +205,46 @@ public class WxMath {
|
|||
return new Coordinate(spd, dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a pressure and temperature to a skew-t x,y coordinate in
|
||||
* centimeters where 0,0 occurs at 1000 hPa and 0 degrees Celsius.
|
||||
*
|
||||
* @param pressure
|
||||
* The pressure in hectoPascals (millibars).
|
||||
* @param temperature
|
||||
* The temperature in degrees Celsius.
|
||||
* @return The calculated coordinate in centimeters.
|
||||
*/
|
||||
public static final Coordinate getSkewTXY(double pressure,
|
||||
double temperature) {
|
||||
temperature -= SoundingPrefs.getSoundingPrefs().getTemperatureOffset();
|
||||
Coordinate point = new Coordinate();
|
||||
|
||||
point.y = 132.182 - 44.061 * Math.log10(pressure);
|
||||
point.x = (0.54 * temperature) + (0.90692 * point.y);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse a skewT coordinate (in centimeters) to the corresponding
|
||||
* temperature and pressure.
|
||||
*
|
||||
* @param point
|
||||
* @return The temperature and pressure. coordinate.x = temperature in
|
||||
* Celsius, coordinate.y = the pressure in hectoPascals (millibars).
|
||||
*/
|
||||
public static final Coordinate reverseSkewTXY(Coordinate point) {
|
||||
Coordinate tempPressure = new Coordinate();
|
||||
tempPressure.y = Math.pow(10, ((point.y - 132.182) / -44.061));
|
||||
tempPressure.x = (point.x - (0.90692 * point.y)) / 0.54;
|
||||
|
||||
tempPressure.x += SoundingPrefs.getSoundingPrefs()
|
||||
.getTemperatureOffset();
|
||||
|
||||
return tempPressure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the final temperature of a parcel moved dry adiabatically from
|
||||
* its initial pressure and temperature to a final pressure.
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.sounding.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
*
|
||||
* Allows the temperature range visible on a skewT chart to be changed by the
|
||||
* user/site.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 15, 2011 bsteffen Initial creation
|
||||
* Aug 21, 2013 2259 bsteffen Add javadoc
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
public class SoundingPrefs {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SoundingPrefs.class);
|
||||
|
||||
private static final String SOUNDING_PREFS_FILE = "sounding/soundingPrefs.xml";
|
||||
|
||||
@XmlElement
|
||||
private double temperatureOffset = 0.0;
|
||||
|
||||
public double getTemperatureOffset() {
|
||||
return temperatureOffset;
|
||||
}
|
||||
|
||||
public void setTemperatureOffset(double temperatureOffset) {
|
||||
this.temperatureOffset = temperatureOffset;
|
||||
}
|
||||
|
||||
private static SoundingPrefs soundingPrefs;
|
||||
|
||||
public static SoundingPrefs getSoundingPrefs() {
|
||||
if(soundingPrefs == null) {
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
File file = pathMgr.getFile(lc, SOUNDING_PREFS_FILE);
|
||||
if(file == null || !file.exists()) {
|
||||
lc = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
|
||||
file = pathMgr.getFile(lc, SOUNDING_PREFS_FILE);
|
||||
}
|
||||
try {
|
||||
soundingPrefs = (SoundingPrefs) SerializationUtil.jaxbUnmarshalFromXmlFile(file);
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
soundingPrefs = new SoundingPrefs();
|
||||
}
|
||||
}
|
||||
return soundingPrefs;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
<soundingPrefs>
|
||||
<temperatureOffset>0</temperatureOffset>
|
||||
</soundingPrefs>
|
Loading…
Add table
Reference in a new issue