13.4.1-1 baseline

Former-commit-id: 2f517b7713 [formerly c03222bb480d87c05982b4d49f863e615b5b5584]
Former-commit-id: 00332e6305
This commit is contained in:
Steve Harris 2013-04-24 17:15:55 -05:00
parent ad51361408
commit 4accbb80db
648 changed files with 9969 additions and 205425 deletions

View file

@ -232,14 +232,6 @@
<param name="feature"
value="com.raytheon.uf.viz.ncep.dataplugins.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.ncep.displays.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.ncep.nsharp.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.viz.avnfps.feature" />
@ -252,6 +244,14 @@
<param name="feature"
value="com.raytheon.uf.viz.d2d.xy.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.ncep.displays.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.ncep.nsharp.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.d2d.nsharp.feature" />

View file

@ -538,8 +538,14 @@ def _retrieveMapData(siteIDs, timeSeconds, parameters=Parameters):
for p in parameters:
task.addParameter(p)
pdcs = GuidanceUtil.getGFEPointsData(task)
i = 0
results = {}
if pdcs is None :
for siteId in siteIDs:
_Logger.info('Data not available for %s', siteID)
results[siteID] = None
return results
i = 0
for siteID in siteIDs:
pdc = pdcs.getContainer(i)
if i < pdcs.getSize() :

View file

@ -133,7 +133,7 @@
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 07, 2013 1735 rferrel Use SiteGridManger to limit calls to server.
#* Mar 07, 2013 1735 rferrel Use SiteGridManager to limit calls to server.
##
import logging, time, cPickle

View file

@ -1,19 +1,19 @@
##
# 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
# 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
#
# 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.
##
@ -48,6 +48,16 @@
# Title: AvnFPS: Incorrect file permission on ISH files
#
#
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 25, 2013 1735 rferrel Retrieve only the last 24 hours of acars records.
##
from com.raytheon.viz.aviation.monitor import LlwsManager
import logging, os, time
@ -86,6 +96,10 @@ def writeLLWS(ident, data):
_Logger.error('Cannot write LLWS file for %s', ident)
def retrieve(siteID, info):
from datetime import timedelta
day = timedelta(days=1)
secondsPerDay = day.total_seconds()
msPerSecond = 1000.0
th = LLWSThread.Server(info)
t = 0
d = {}
@ -96,12 +110,17 @@ def retrieve(siteID, info):
profilerIds = th.processProfilerData(siteID)
for profilerId in profilerIds:
try :
shear = th.genShear(siteID, profilerId)
d[profilerId] = shear
except LLWSThread.InValid:
pass
shear = th.genShear(siteID, profilerId)
d[profilerId] = shear
except LLWSThread.InValid:
pass
acarsRec = LlwsManager.getAcarsRecord(siteID, 0)
# This gets all acarsRec in the database since 0 retrieves from the epoch.
# This may be ok if database is purged frequently.
# How far back should it go 1, 6, 12, 24 hours?
# acarsRec = LlwsManager.getAcarsRecord(siteID, 0)
refTime = long((time.time() - secondsPerDay) * msPerSecond)
acarsRec = LlwsManager.getAcarsRecord(siteID, refTime)
if acarsRec:
acarsId = siteID[1:]
th.processAcarsData(acarsId,acarsRec)
@ -111,7 +130,7 @@ def retrieve(siteID, info):
except LLWSThread.InValid:
pass
else:
_Logger.info('Missing ACARS Sounding data for %s.', siteID)
_Logger.info('Missing ACARS Sounding data for %s.', siteID)
radars = info['sites']['radars']
for radar in radars:
vwp = LlwsManager.getVerticalWindProfile(radar, 0)

View file

@ -95,7 +95,6 @@ class Monitor(MonitorP.Monitor):
def __compare(self, taf):
now = time.time()
text, maxval = [], -1.0
#data = Globals.DRC.getLLWS(self.info['ident'])
data = LLWSData.retrieve(self.info['ident'], self.info)
if data is None:
data = []

View file

@ -159,6 +159,17 @@
# Status: CLOSED
# Title: AvnFPS: AvnFPS regression based lightning forecast to use LAMP
#
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 25, 2013 1735 rferrel __initializeLLWSDictsLists now reads cfg data only for
#* desired site instead of all sites. So it is O(n) instead of O(n**2)
##
#
import logging, os, Queue, re, time, math, sys
import Avn, AvnParser, LLWSData, MetarData
@ -184,7 +195,6 @@ class Server(object):
__TimeOut = 10.0
def __init__(self, info):
#self.name = info['name']
self.profilerList = []
self.radarList = []
self.metarList = []
@ -207,7 +217,8 @@ class Server(object):
rList = []
aList = []
for m in AvnParser.getTafHeaders():
m = info['ident']
if m is not None:
siteDict = AvnParser.getTafSiteCfg(m)
try:
radars = siteDict['sites']['radars']
@ -226,17 +237,16 @@ class Server(object):
except KeyError:
acars = []
if profilers == [] and radars == [] and acars == []:
continue
#
# This TAF site needs to be monitored
self.metarList.append(m)
self.siteVWPsDict[m] = [radars,profilers,radar_cutoff,profiler_cutoff]
self.acarsDict[m] = [acars]
#
pList.extend(profilers)
rList.extend(radars)
aList.extend(acars)
if len(profilers) > 0 or len(radars) > 0 or len(acars) > 0 :
#
# This TAF site needs to be monitored
self.metarList.append(m)
self.siteVWPsDict[m] = [radars,profilers,radar_cutoff,profiler_cutoff]
self.acarsDict[m] = [acars]
#
pList.extend(profilers)
rList.extend(radars)
aList.extend(acars)
#
# Find all unique radars and profilers to monitor
self.profilerList = dict.fromkeys(pList).keys()

View file

@ -32,6 +32,7 @@ import ForecastPointDataRetrieve, NoDataException
# ------------ ---------- ----------- --------------------------
# 09/15/09 njensen Initial Creation.
# 26APR2012 14688 rferrel Use ForecastPointDataRetrieve.
# 03APR2013 1735 rferrel Limit retrieval for forecast times to the number used.
#
#
#
@ -39,23 +40,24 @@ import ForecastPointDataRetrieve, NoDataException
PARAMETERS = ['tstorm2hr', 'stationId', 'refTime', 'fcstHr']
LOOK_AHEAD = 3 # hours
SEC_PER_HOUR = 60*60
_Logger = logging.getLogger(Avn.CATEGORY)
def retrieve(siteID):
try:
pdc = ForecastPointDataRetrieve.retrieve('bufrmosLAMP', siteID, PARAMETERS)
def retrieve(siteID):
try:
pdc = ForecastPointDataRetrieve.retrieve('bufrmosLAMP', siteID, PARAMETERS, forecastTimesLimit=3)
except NoDataException.NoDataException:
return None
pots = []
try:
# assume pdc[0] is 0 hour and not used in the forecast.
vtime = pdc[1]['refTime'] / 1000.0 + LOOK_AHEAD*3600
vtime = pdc[1]['refTime'] / 1000.0 + LOOK_AHEAD*SEC_PER_HOUR
for n in range(1, LOOK_AHEAD):
pdv = pdc[n]
pots.append(pdv['tstorm2hr'])
data = max([x for x in pots if 0<= x <= 100] + [0])
return {'from': vtime-LOOK_AHEAD*3600, 'to': vtime, 'prob': min(data, 100)}
data = max([x for x in pots if 0 <= x <= 100] + [0])
return {'from': vtime-LOOK_AHEAD*SEC_PER_HOUR, 'to': vtime, 'prob': min(data, 100)}
except KeyError:
return None

View file

@ -261,7 +261,8 @@ class Procedure (SmartScript.SmartScript):
if checkOnly:
self.createGrid(MODEL, "MaxLessThanMin", "SCALAR", mask.astype('float32'),
maxTR, minAllowedValue=0.0, maxAllowedValue= 1.0)
maxTR, minAllowedValue=0.0, maxAllowedValue= 1.0,
units="", descriptiveName="")
else: # force the change
if maxTR in maxTLocks:
msg = "Can't modify MaxT grid at " + str(maxTR) + \

View file

@ -214,13 +214,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.spatial"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.level"
download-size="0"

View file

@ -34,7 +34,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: ext, registered, global
Eclipse-RegisterBuddy: org.apache.velocity, org.apache.log4j, com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level
Eclipse-RegisterBuddy: org.apache.velocity, org.apache.log4j, com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm
Export-Package: com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.alerts,
com.raytheon.uf.viz.core.auth,

View file

@ -8,12 +8,18 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="caveCredentialHandler" class="com.raytheon.uf.viz.core.comm.CaveHttpsCredentialsHandler" />
<bean id="httpsConfiguration" class="com.raytheon.uf.viz.core.comm.HttpsConfiguration" />
<bean id="httpClient" class="com.raytheon.uf.common.comm.HttpClient" factory-method="getInstance">
<property name="socketTimeout" value="330000"/>
<property name="connectionTimeout" value="10000"/>
<property name="maxConnectionsPerHost" value="10"/>
<property name="compressRequests" value="false"/>
<property name="gzipResponseHandling" value="false"/>
<property name="handler" ref="caveCredentialHandler" />
<property name="httpsConfiguration" ref="httpsConfiguration" />
</bean>
<bean id="baosPool" class="com.raytheon.uf.common.util.ByteArrayOutputStreamPool" factory-method="getInstance">

View file

@ -17,46 +17,41 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler;
package com.raytheon.uf.viz.core.comm;
import com.raytheon.edex.plugin.gfe.isc.GfeScriptExecutor;
import com.raytheon.uf.common.dataplugin.gfe.request.CreateNetCDFGridRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
/**
* TODO Add Description
* Cave implementation of the IHttpsCredentialsHandler. Displays the Cave login
* dialog to get the authorization credentials.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 24, 2010 dgilling Initial creation
* Mar 4, 2013 1786 mpduff Initial creation
*
* </pre>
*
* @author dgilling
* @author mpduff
* @version 1.0
*/
public class CreateNetCDFGridRequestHandler implements
IRequestHandler<CreateNetCDFGridRequest> {
public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
/**
* {@inheritDoc}
*/
@Override
public ServerResponse<String> handleRequest(CreateNetCDFGridRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
GfeScriptExecutor scriptRunner = new GfeScriptExecutor();
String retVal = scriptRunner.execute("ifpnetCDF "
+ request.getArgString());
if (!retVal.equals(GfeScriptExecutor.SUCCESS)) {
sr.addMessage(retVal);
public String[] getCredentials(String message) {
// If message contains an "=" split and take the value of the pair
if (message.contains("=")) {
message = message.split("=")[1];
}
return sr;
HttpsLoginDlg login = new HttpsLoginDlg(message);
login.open();
return login.getCredentials();
}
}

View file

@ -19,14 +19,14 @@
**/
package com.raytheon.uf.viz.core.comm;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.net.URI;
import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.http.client.methods.HttpGet;
import com.raytheon.uf.common.comm.HttpClient;
/**
* Class for checking connectivity of http servers, currently only used for
@ -43,6 +43,7 @@ import org.apache.activemq.ActiveMQConnectionFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 12, 2009 mschenke Initial creation
* Mar 22, 2013 1786 mpduff Changed to use HttpClient for connectivity.
*
* </pre>
*
@ -71,16 +72,14 @@ public class ConnectivityManager {
* @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity
*/
public static void checkServer(String server, IConnectivityCallback callback) {
boolean good = true;
public static void checkHttpServer(String server, IConnectivityCallback callback) {
boolean good = false;
try {
new URL(server).openStream().close();
} catch (ConnectException e) {
good = false;
} catch (MalformedURLException e) {
good = false;
} catch (UnknownHostException e) {
good = false;
HttpClient client = HttpClient.getInstance();
HttpGet request = new HttpGet();
request.setURI(new URI(server));
client.executeRequest(request);
good = true;
} catch (Exception e) {
// ignore
}

View file

@ -0,0 +1,106 @@
/**
* 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.viz.core.comm;
import java.net.URI;
import java.net.URISyntaxException;
import com.raytheon.uf.common.comm.IHttpsConfiguration;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
/**
* Https Configuration Class.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 9, 2013 1786 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class HttpsConfiguration implements IHttpsConfiguration {
private int httpsPort = 443;
private int httpPort = 80;
/**
* Constructor.
*/
public HttpsConfiguration() {
init();
}
private void init() {
String localizationServer = LocalizationManager.getInstance()
.getLocalizationServer();
try {
URI uri = new URI(localizationServer);
if (uri.getScheme().equals("http")) {
httpPort = uri.getPort();
} else if (uri.getScheme().equals("https")) {
httpsPort = uri.getPort();
if (httpsPort == -1) {
httpsPort = 443; // The default https port
}
} else {
throw new URISyntaxException(uri.toString(), "Invalid server");
}
} catch (URISyntaxException e) {
System.err.println("Invalid localization server setting.");
}
}
/**
* {@inheritDoc}
*/
@Override
public int getHttpsPort() {
return httpsPort;
}
/**
* {@inheritDoc}
*/
@Override
public int getHttpPort() {
return httpPort;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("HTTP Port: ").append(this.httpPort).append("\n");
sb.append("HTTPS Port: ").append(this.httpsPort).append("\n");
return sb.toString();
}
}

View file

@ -0,0 +1,226 @@
/**
* 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.viz.core.comm;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
/**
* CAVE Login Dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 6, 2013 1786 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class HttpsLoginDlg extends Dialog {
private static final long serialVersionUID = 1L;
private Shell shell;
private Display display;
/** User name text field */
private Text userText;
/** Password text field */
private Text passwdText;
/** Array of User name and Password */
private String[] returnValue;
/** Authorization message */
private final String message;
/**
* Constructor
*
* @param message
* Message from server
*/
public HttpsLoginDlg(String message) {
super(new Shell(Display.getDefault(), SWT.TITLE));
this.message = message;
}
/**
* Open the dialog.
*/
public void open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText("Log in");
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
shell.setLayout(mainLayout);
init();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Build the gui
*/
private void init() {
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new GridLayout(2, false));
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 500;
gd.horizontalSpan = 2;
Label authMessage = new Label(comp, SWT.CENTER);
authMessage.setText(this.message);
authMessage.setLayoutData(gd);
Label userIdLbl = new Label(comp, SWT.LEFT);
userIdLbl.setText("User Name: ");
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
userText = new Text(comp, SWT.BORDER);
userText.setLayoutData(gd);
Label passLbl = new Label(comp, SWT.LEFT);
passLbl.setText("Password: ");
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
passwdText = new Text(comp, SWT.BORDER);
passwdText.setEchoChar('*');
passwdText.setLayoutData(gd);
Composite buttonComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
buttonComp.setLayout(gl);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
buttonComp.setLayoutData(gd);
gd = new GridData(80, SWT.DEFAULT);
Button okBtn = new Button(buttonComp, SWT.NONE);
okBtn.setText("OK");
okBtn.setLayoutData(gd);
shell.setDefaultButton(okBtn);
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (validateEntries()) {
returnValue = new String[] { userText.getText().trim(),
passwdText.getText().trim() };
}
shell.dispose();
}
});
gd = new GridData(80, SWT.DEFAULT);
Button cancelBtn = new Button(buttonComp, SWT.NONE);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
cancel();
}
});
}
/**
* Validate the entries.
*
* @return true if entries are valid
*/
private boolean validateEntries() {
boolean valid = true;
if (this.userText.getText().trim().isEmpty()) {
valid = false;
}
if (this.passwdText.getText().trim().isEmpty()) {
valid = false;
}
return valid;
}
/**
* Get the user's credentials
*
* @return String array of Username and password
*/
public String[] getCredentials() {
return returnValue;
}
/**
* Cancel action
*/
private void cancel() {
// Check if CAVE is running and exit if it is not
if (!PlatformUI.isWorkbenchRunning()) {
System.exit(0);
}
shell.dispose();
}
/**
* Main for testing
*
* @param args
* args
*/
public static void main(String[] args) {
HttpsLoginDlg loginDlg = new HttpsLoginDlg(
"AWIPS II Thin Client Proxy: Use NOAA email address and password");
loginDlg.open();
String[] credentials = loginDlg.getCredentials();
if (credentials != null) {
System.out.println(credentials[0] + " " + credentials[1]);
} else {
System.out.println("Nothing entered");
}
}
}

View file

@ -363,7 +363,7 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
private void validateLocalization() {
ConnectivityManager.checkServer(localization, localizationCallback);
ConnectivityManager.checkHttpServer(localization, localizationCallback);
}
private void validateAlertviz() {

View file

@ -217,7 +217,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
private void checkConnectivity() {
final ConnectivityResult result = new ConnectivityResult(false, "");
Text text = localizationEditor.getTextControl(getFieldEditorParent());
ConnectivityManager.checkServer(text.getText().trim(),
ConnectivityManager.checkHttpServer(text.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {

View file

@ -83,7 +83,7 @@ public class LocalizationServerEditor extends StringFieldEditor implements
@Override
protected boolean doCheckState() {
if (httpCheck) {
ConnectivityManager.checkServer(this.getTextControl().getText(),
ConnectivityManager.checkHttpServer(this.getTextControl().getText(),
this);
} else {
ConnectivityManager.checkJmsServer(this.getTextControl().getText(),

View file

@ -124,8 +124,6 @@ public class SystemRuleManager {
*/
private SystemRuleManager() {
createContext();
loadLatencyRules();
loadPriorityRules();
}
/**
@ -409,6 +407,10 @@ public class SystemRuleManager {
*/
private LatencyRulesXML getLatencyRules(boolean reread) {
if (latencyRules == null || reread) {
if (latencyRulesLocFile == null) {
loadLatencyRules();
}
if (this.latencyRulesLocFile != null
&& latencyRulesLocFile.exists()) {
try {
@ -434,7 +436,11 @@ public class SystemRuleManager {
* @return The priority rules xml object
*/
private PriorityRulesXML getPriorityRules(boolean reread) {
if (priorityRules == null || reread)
if (priorityRules == null || reread) {
if (priorityRulesLocFile == null) {
loadPriorityRules();
}
if (this.priorityRulesLocFile != null
&& priorityRulesLocFile.exists()) {
try {
@ -446,7 +452,7 @@ public class SystemRuleManager {
priorityRules = new PriorityRulesXML();
}
}
}
return priorityRules;
}

View file

@ -196,7 +196,6 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
} else {
this.derParLibrary = derParLibrary;
}
long startTime = System.currentTimeMillis();
DataTree newTree = null;
newTree = createBaseTree();
if (newTree == null) {
@ -224,9 +223,6 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
}
}
}
System.out.println("Time to initialize "
+ this.getClass().getSimpleName() + ": "
+ (System.currentTimeMillis() - startTime) + "ms");
}
@Override

View file

@ -420,13 +420,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.spatial"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.alertmonitor"
download-size="0"

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.gisdatastore.ui;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
@ -49,7 +47,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 27, 2012 randerso Initial creation
* Apr 9, 2013 #1860 randerso Fix image disposed issued on Windows
*
* </pre>
*
@ -90,7 +87,7 @@ public class LineStyleDialog extends Dialog {
continue;
}
TableItem item = new TableItem(table, SWT.NONE);
final Image image = new Image(d, 128, 10);
Image image = new Image(d, 128, 10);
Rectangle bounds = image.getBounds();
int[] dashes = ls.getSWTLineStyle();
GC gc = new GC(image);
@ -101,14 +98,7 @@ public class LineStyleDialog extends Dialog {
gc.dispose();
item.setImage(image);
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
image.dispose();
}
});
image.dispose();
item.setData(ls);
if (ls.equals(this.style)) {

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.gisdatastore.ui;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
@ -47,7 +45,6 @@ import org.eclipse.swt.widgets.TableItem;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 27, 2012 randerso Initial creation
* Apr 9, 2013 #1860 randerso Fix image disposed issued on Windows
*
* </pre>
*
@ -91,7 +88,7 @@ public class LineWidthDialog extends Dialog {
for (int w = min; w <= max; w++) {
TableItem item = new TableItem(table, SWT.NONE);
final Image image = new Image(d, 128, 10);
Image image = new Image(d, 128, 10);
Rectangle bounds = image.getBounds();
GC gc = new GC(image);
gc.fillRectangle(bounds);
@ -101,13 +98,7 @@ public class LineWidthDialog extends Dialog {
gc.dispose();
item.setImage(image);
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
image.dispose();
}
});
image.dispose();
item.setData(w);
if (w == this.width) {

View file

View file

View file

@ -58,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Initial creation
* Dec 6, 2012 1353 rferrel Make dialog non-blocking.
* Apr 01, 2013 1830 mpduff Don't allow base files.
*
* </pre>
*
@ -318,8 +319,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
IPathManager pm = PathManagerFactory.getPathManager();
ArrayList<LocalizationContext> contextList = new ArrayList<LocalizationContext>();
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.BASE));
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.SITE));
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,

View file

@ -582,7 +582,7 @@ public class FFMPDataGenerator {
if (displayName != null) {
String cbasinPfaf = cBasin.getPfaf().toString();
StringBuilder sb = new StringBuilder(cbasinPfaf);
sb.append(cbasinPfaf).append("\n").append(displayName);
sb.append("\n").append(displayName);
trd.setPfaf(cbasinPfaf);
trd.setTableCellData(0, new FFMPTableCellData(rowField,
displayName, sb.toString()));

View file

@ -163,6 +163,8 @@ import com.vividsolutions.jts.geom.Point;
* Feb 20, 2013 1635 dhladky Fixed multiple guidance display
* Feb 28, 2013 1729 dhladky Changed the way the loaders are managed via the status updates.
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* Apr 10, 2013 1896 bsteffen Make FFMPResource work better with D2D
* time matcher.
* </pre>
*
* @author dhladky
@ -242,10 +244,10 @@ public class FFMPResource extends
private final FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
/** Basin shaded shape **/
protected ConcurrentHashMap<DataTime, FFMPDrawable> drawables = new ConcurrentHashMap<DataTime, FFMPDrawable>();
protected Map<DataTime, FFMPDrawable> drawables = new ConcurrentHashMap<DataTime, FFMPDrawable>();
/** VGB drawables **/
protected HashMap<String, PixelCoverage> vgbDrawables = new HashMap<String, PixelCoverage>();
protected Map<String, PixelCoverage> vgbDrawables = new HashMap<String, PixelCoverage>();
/** used to create the wireframes for the streams **/
private Set<Long> streamPfafIds = null;
@ -2886,7 +2888,7 @@ public class FFMPResource extends
private void generateShapes(FFMPTemplates templates, String huc,
Long pfaf, Map<Long, Geometry> geomMap, Request req,
IColormapShadedShape shape, HashMap<Object, RGB> colorMap) {
IColormapShadedShape shape, Map<Object, RGB> colorMap) {
// my logic
Geometry g = geomMap.get(pfaf);
@ -4194,6 +4196,12 @@ public class FFMPResource extends
});
}
}
if (event.getSource() instanceof FFMPLoaderStatus) {
FFMPLoaderStatus status = (FFMPLoaderStatus) event.getSource();
if (status.isDone()) {
issueRefresh();
}
}
}
/**
@ -4383,4 +4391,14 @@ public class FFMPResource extends
}
}
@Override
public DataTime[] getDataTimes() {
List<Date> dates = getTimeOrderedKeys();
DataTime[] dataTimes = new DataTime[dates.size()];
for (int i = 0; i < dataTimes.length; i += 1) {
dataTimes[i] = new DataTime(dates.get(i));
}
return dataTimes;
}
}

View file

@ -5,50 +5,26 @@ Bundle-SymbolicName: com.raytheon.uf.viz.npp.crimss;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.crimss.Activator
Bundle-Vendor: RAYTHEON
Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.6.1",
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0",
com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0",
com.raytheon.uf.viz.points;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0"
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.npp.crimss,
com.raytheon.uf.common.dataquery.requests,
com.raytheon.uf.common.dataquery.responses,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.status,
com.raytheon.uf.common.time,
com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.drawables,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.map,
com.raytheon.uf.viz.core.maps.display,
com.raytheon.uf.viz.core.procedures,
com.raytheon.uf.viz.core.requests,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.viz.d2d.core.map,
com.raytheon.uf.viz.d2d.nsharp.display,
com.raytheon.uf.viz.d2d.nsharp.rsc,
com.raytheon.uf.viz.productbrowser,
com.raytheon.viz.core.graphing,
com.raytheon.viz.pointdata,
com.raytheon.viz.ui,
com.raytheon.viz.ui.editor,
com.raytheon.viz.ui.input,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.edex.common.sounding,
gov.noaa.nws.ncep.ui.nsharp,
gov.noaa.nws.ncep.ui.nsharp.natives,
javax.measure.converter,
javax.measure.unit,
org.eclipse.swt.graphics,
org.eclipse.swt.widgets
Export-Package: com.raytheon.uf.viz.npp.crimss,
com.raytheon.uf.viz.npp.crimss.map
Export-Package: com.raytheon.uf.viz.npp.crimss
Import-Package: gov.noaa.nws.ncep.edex.common.sounding

View file

@ -1,2 +1 @@
com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData
com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData
com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData

View file

@ -19,10 +19,10 @@
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="separator" id="beforeCRIMSS" visible="false"/>
<contribute xsi:type="titleItem" titleText="------ CrIMSS ------" id="SoundingLine"/>
<contribute xsi:type="bundleItem" file="bundles/crimssAvailability.xml"
menuText="Sounding Availability" id="CrIMSSAvailability">
<contribute xsi:type="bundleItem" file="bundles/npp/soundingAvailability.xml"
menuText="CrIMSS Sounding Availability" id="CrIMSSAvailability">
<substitute key="name" value="CrIMSS"/>
<substitute key="pluginName" value="crimss"/>
<substitute key="soundingResourceData" value="com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData"/>
</contribute>
<contribute xsi:type="separator" id="afterCRIMSS" visible="false"/>
</menuTemplate>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Soundings" fileName="menus/npp/crimss/crimssMenuItems.xml"/>
</menuContributionFile>

View file

@ -44,7 +44,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDescriptor;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDisplay;
import com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData;
import com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData;
import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
@ -229,7 +229,10 @@ public class CrimssDataDefinition
for (int i = 0; i < selection.length; i++) {
if (order[i].equals(POINT)) {
if (selection[i].equals(MAP_RESOURCE)) {
resourceData = new CrimssMapResourceData();
NPPSoundingMapResourceData nsmrd = new NPPSoundingMapResourceData();
nsmrd.setNsharpResourceData(CrimssNSharpResourceData.class);
nsmrd.setResourceName("CrIMSS");
resourceData = nsmrd;
}
}
}

View file

@ -19,15 +19,10 @@
**/
package com.raytheon.uf.viz.npp.crimss;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube.QueryStatus;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -39,19 +34,12 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
import com.raytheon.viz.pointdata.PointDataRequest;
import com.vividsolutions.jts.geom.Coordinate;
import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData;
/**
* TODO Add Description
* NSharp resource data capable of loading CrIMSS data
*
* <pre>
*
@ -68,9 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
*/
@XmlAccessorType(XmlAccessType.NONE)
public class CrimssNSharpResourceData extends D2DNSharpResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CrimssNSharpResourceData.class);
public class CrimssNSharpResourceData extends AbstractNPPNSharpResourceData {
private static final String PLUGIN = "crimss";
@ -80,95 +66,28 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
CrimssRecord.PDV_H2O, CrimssRecord.PDV_P_H2O,
CrimssRecord.PDV_TEMPERATURE, CrimssRecord.PDV_P_TEMPERATURE };
private static final Unit<?> PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
private static final Unit<?> HEIGHT_UNIT = SI.METER;
private static final Unit<?> TEMPERATURE_UNIT = SI.CELSIUS;
private static final Unit<?> H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM);
private static final Unit<?> DEWPOINT_UNIT = SI.CELSIUS;
public CrimssNSharpResourceData() {
super("CRiMSS");
}
@Override
protected void preparePointInfo() throws VizException {
// everything should already be set
return;
super("CrIMSS", PLUGIN, PARAMETERS);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube
* (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo)
* @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData#
* getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView)
*/
@Override
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
DataTime time = new DataTime(stnInfo.getReftime());
try {
PointDataContainer pdc = PointDataRequest
.requestPointDataAllLevels(time, PLUGIN, PARAMETERS, null,
getMetadataMap());
PointDataView pdv = null;
Coordinate closest = null;
for (int i = 0; i < pdc.getCurrentSz(); i++) {
PointDataView testPdv = pdc.readRandom(i);
Coordinate p = new Coordinate(
testPdv.getFloat(CrimssRecord.LONGITUDE),
testPdv.getFloat(CrimssRecord.LATITUDE));
if (closest == null
|| coordinate.distance(p) < coordinate
.distance(closest)) {
pdv = testPdv;
closest = p;
}
}
if (pdv == null) {
return null;
}
List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>();
layers.add(getSurfacePressureLayer(pdv));
layers.addAll(getHeightLayers(pdv));
layers.addAll(getTemperatureLayers(pdv));
layers.addAll(getDewpointLayers(pdv));
Collections.sort(layers,
NsharpDataHandling.reversePressureHeightWindComparator());
mergeDuplicates(layers);
// We have to interpolate everything so that height,temperature, and
// dewpoint are available on all levels.
interpolateHeight(layers);
interpolateTemperature(layers);
interpolateDewpoint(layers);
Iterator<NcSoundingLayer> iter = layers.iterator();
while (iter.hasNext()) {
NcSoundingLayer layer = iter.next();
if (layer.getPressure() < 0) {
iter.remove();
} else if (layer.getGeoHeight() < 0) {
iter.remove();
} else if (layer.getTemperature() < -300) {
iter.remove();
} else if (layer.getDewpoint() < -300) {
iter.remove();
}
}
NcSoundingProfile profile = new NcSoundingProfile();
profile.setSoundingLyLst(layers);
// TODO populate other fields in profile
NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile));
cube.setRtnStatus(QueryStatus.OK);
return cube;
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
return null;
protected List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
throws VizException {
List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>();
layers.add(getSurfacePressureLayer(pdv));
layers.addAll(getHeightLayers(pdv));
layers.addAll(getTemperatureLayers(pdv));
layers.addAll(getDewpointLayers(pdv));
Collections.sort(layers,
NsharpDataHandling.reversePressureHeightWindComparator());
mergeDuplicates(layers);
return layers;
}
private static NcSoundingLayer getSurfacePressureLayer(PointDataView pdv) {
@ -278,7 +197,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
float pressure = pressureArray[j].floatValue();
pressure = (float) pressureConverter.convert(pressure);
float h2o = h2oArray[j].floatValue();
h2o = (float) h2oConverter.convert(h2o);
float dpt = convertH2OtoDewpoint(h2o, pressure);
dpt = (float) dewpointConverter.convert(dpt);
NcSoundingLayer layer = new NcSoundingLayer(pressure,
@ -292,13 +210,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
return layers;
}
// convert h2o in g/kg and pressure in hPa to dewpoint in kelvin.
private static float convertH2OtoDewpoint(float h2o, float pressure) {
double eee = pressure * h2o / (622.0 + 0.378 * h2o);
double b = 26.66082 - Math.log(eee);
return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048);
}
private static void mergeDuplicates(List<NcSoundingLayer> layers) {
// Merge any soundings at same pressure.
Iterator<NcSoundingLayer> iter = layers.iterator();
@ -322,80 +233,4 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
}
}
private static void interpolateHeight(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getGeoHeight() < 0) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateTemperature(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getTemperature() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getTemperature()
- layerBelow.getTemperature();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateDewpoint(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getDewpoint() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
}

View file

@ -1,65 +0,0 @@
/**
* 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.viz.npp.crimss.map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 7, 2011 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class CrimssMapResourceData extends AbstractRequestableResourceData {
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
CrimssMapResource resource = new CrimssMapResource(this, loadProperties);
for (PluginDataObject pdo : objects) {
if (pdo instanceof CrimssRecord) {
resource.addRecord((CrimssRecord) pdo);
}
}
return resource;
}
}

View file

@ -38,14 +38,33 @@
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.crimss"
id="com.raytheon.uf.common.dataplugin.npp.sounding"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.npp.crimss"
id="com.raytheon.uf.viz.npp"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.viz.npp.sounding"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.nucaps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.npp.nucaps"
download-size="0"
install-size="0"
version="0.0.0"/>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.wcs</name>
<name>com.raytheon.uf.viz.npp.nucaps</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,4 +1,4 @@
#Fri Jun 08 12:00:15 CDT 2012
#Thu Jan 17 15:46:54 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

View file

@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NUCAPS Viz Plugin
Bundle-SymbolicName: com.raytheon.uf.viz.npp.nucaps
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.nucaps.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.nucaps;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0",
com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0",
com.raytheon.viz.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
javax.measure;bundle-version="1.0.0",
meteolib.jni;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: gov.noaa.nws.ncep.edex.common.sounding

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.npp.nucaps.NucapsNSharpResourceData

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Soundings" fileName="menus/npp/nucaps/nucapsMenuItems.xml"/>
</menuContributionFile>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/npp/soundingAvailability.xml"
menuText="NUCAPS Sounding Availability" id="NUCAPSAvailability">
<substitute key="name" value="NUCAPS"/>
<substitute key="pluginName" value="nucaps"/>
<substitute key="soundingResourceData" value="com.raytheon.uf.viz.npp.nucaps.NucapsNSharpResourceData"/>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,30 @@
package com.raytheon.uf.viz.npp.nucaps;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,141 @@
/**
* 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.viz.npp.nucaps;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import java.util.ArrayList;
import java.util.List;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.edex.meteolibrary.Meteolibrary;
import com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData;
/**
* NSharp resource data capable of loading NUCAPS data
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 15, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class NucapsNSharpResourceData extends AbstractNPPNSharpResourceData {
private static final String PLUGIN = "nucaps";
private static final String[] PARAMETERS = { NucapsRecord.LONGITUDE,
NucapsRecord.LATITUDE, NucapsRecord.PDV_SURFACE_PRESSURE,
NucapsRecord.PDV_PRESSURE, NucapsRecord.PDV_TEMPERATURE,
NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO };
public NucapsNSharpResourceData() {
super("NUCAPS", PLUGIN, PARAMETERS);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData#
* getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView)
*/
@Override
protected List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
throws VizException {
Number[] pressures = pdv.getNumberAllLevels(NucapsRecord.PDV_PRESSURE);
UnitConverter pressureConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_PRESSURE), PRESSURE_UNIT);
Number[] temperatures = pdv
.getNumberAllLevels(NucapsRecord.PDV_TEMPERATURE);
UnitConverter temperatureConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_TEMPERATURE), TEMPERATURE_UNIT);
UnitConverter temperatureCalcConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_TEMPERATURE),
TEMPERATURE_CALC_UNIT);
Number[] wvMixingRatios = pdv
.getNumberAllLevels(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO);
UnitConverter wvMixingRatioConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO),
H2O_UNIT);
UnitConverter dewPointConverter = getConverter(SI.KELVIN, SI.CELSIUS);
if (pressures.length != temperatures.length
|| pressures.length != wvMixingRatios.length) {
throw new VizException("NUCAPS PointData sizes incorrect");
}
int length = pressures.length;
List<NcSoundingLayer> soundingLayers = new ArrayList<NcSoundingLayer>(
length);
float surfacePressure = pdv.getFloat(NucapsRecord.PDV_SURFACE_PRESSURE);
for (int i = 0; i < length; ++i) {
int idx = i;
float pressure = (float) pressureConverter.convert(pressures[idx]
.doubleValue());
if (pressure <= surfacePressure) {
// Don't add entries where pressure indicates below ground
float gh = Meteolibrary.ptozsa(new float[] { pressure }, 0);
Number temperature = temperatures[idx];
float h20 = (float) wvMixingRatioConverter
.convert(wvMixingRatios[idx].doubleValue());
float dewpoint = convertH2OtoDewpoint(h20, pressure);
float rh = convertH20ToRelativeHumidity(h20,
(float) temperatureCalcConverter.convert(temperature
.doubleValue()), pressure);
soundingLayers.add(new NcSoundingLayer(pressure, gh,
(float) temperatureConverter.convert(temperature
.doubleValue()), (float) dewPointConverter
.convert(dewpoint), NcSoundingLayer.MISSING,
NcSoundingLayer.MISSING, NcSoundingLayer.MISSING,
NcSoundingLayer.MISSING, NcSoundingLayer.MISSING, h20,
rh));
}
}
return soundingLayers;
}
private UnitConverter getConverter(Unit<?> fromUnit, Unit<?> toUnit)
throws VizException {
if (fromUnit.isCompatible(toUnit)) {
return fromUnit.getConverterTo(toUnit);
}
throw new VizException("Unable to convert " + fromUnit + " to "
+ toUnit);
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.ogc.common</name>
<name>com.raytheon.uf.viz.npp.sounding</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,4 +1,4 @@
#Fri Jun 08 11:56:09 CDT 2012
#Mon Jan 14 13:20:29 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

View file

@ -0,0 +1,28 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Viz Sounding
Bundle-SymbolicName: com.raytheon.uf.viz.npp.sounding;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.sounding.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.6.1",
com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: gov.noaa.nws.ncep.edex.common.sounding
Export-Package: com.raytheon.uf.viz.npp.sounding.rsc

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -24,11 +24,12 @@
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true"/>
<resourceData xsi:type="crimssMapResourceData" retrieveData="true" isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true">
<resourceData xsi:type="nppSoundingMapResourceData">
<nsharpResourceData>${soundingResourceData}</nsharpResourceData>
<resourceName>${name;Unknown}</resourceName>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="crimss" constraintType="EQUALS"/>
<constraint constraintValue="${pluginName}" constraintType="EQUALS"/>
</mapping>
</metadataMap>
</resourceData>

View file

@ -0,0 +1,41 @@
package com.raytheon.uf.viz.npp.sounding;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
public class Activator implements BundleActivator {
public static final IUFStatusHandler statusHandler = UFStatus
.getHandler(Activator.class);
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,339 @@
/**
* 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.viz.npp.sounding.rsc;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube.QueryStatus;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.DataTime.FLAG;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
import com.raytheon.uf.viz.npp.sounding.Activator;
import com.raytheon.viz.pointdata.PointDataRequest;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Abstract NPP Sounding resource data
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractNPPNSharpResourceData extends
D2DNSharpResourceData {
public static class NPPNsharpStationInfo extends NsharpStationInfo {
private TimeRange timeRange;
public NPPNsharpStationInfo(NsharpStationInfo info, DataTime time) {
this.latitude = info.getLatitude();
this.longitude = info.getLongitude();
this.reftime = new Timestamp(info.getReftime().getTime());
if (info.getRangestarttime() != null) {
this.rangestarttime = new Timestamp(info.getRangestarttime()
.getTime());
}
this.sndType = info.getSndType();
this.stnDisplayInfo = info.getStnDisplayInfo();
this.timeLineSpList = new ArrayList<NsharpStationInfo.timeLineSpecific>(
info.getTimeLineSpList());
setDataTime(time);
}
public void setDataTime(DataTime time) {
this.reftime = new Timestamp(time.getMatchRef());
if (time.getUtilityFlags().contains(FLAG.PERIOD_USED)) {
this.timeRange = time.getValidPeriod();
}
}
public DataTime getDataTime() {
if (timeRange != null) {
return new DataTime(getReftime().getTime(), timeRange);
} else {
return new DataTime(new Date(getReftime().getTime()));
}
}
}
protected static final Unit<?> PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
protected static final Unit<?> HEIGHT_UNIT = SI.METER;
protected static final Unit<?> TEMPERATURE_UNIT = SI.CELSIUS;
protected static final Unit<?> TEMPERATURE_CALC_UNIT = SI.KELVIN;
protected static final Unit<?> H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM);
protected static final Unit<?> DEWPOINT_UNIT = SI.CELSIUS;
private final String plugin;
private final String[] parameters;
public AbstractNPPNSharpResourceData() {
// This constructor only exists so JAXB won't complain
throw new UnsupportedOperationException();
}
protected AbstractNPPNSharpResourceData(String name, String plugin,
String[] parameters) {
super(name);
this.plugin = plugin;
this.parameters = parameters;
}
@Override
protected void preparePointInfo() throws VizException {
// everything should already be set
return;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#createStationInfo
* (com.raytheon.uf.common.time.DataTime)
*/
@Override
protected NsharpStationInfo createStationInfo(DataTime time) {
return new NPPNsharpStationInfo(super.createStationInfo(time), time);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube
* (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo)
*/
@Override
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
DataTime time = new DataTime(stnInfo.getReftime());
if (stnInfo instanceof NPPNsharpStationInfo) {
time = ((NPPNsharpStationInfo) stnInfo).getDataTime();
}
try {
PointDataContainer pdc = PointDataRequest
.requestPointDataAllLevels(time, plugin, parameters, null,
getMetadataMap());
PointDataView pdv = null;
Coordinate closest = null;
for (int i = 0; i < pdc.getCurrentSz(); i++) {
PointDataView testPdv = pdc.readRandom(i);
Coordinate p = new Coordinate(
testPdv.getFloat(NPPSoundingRecord.LONGITUDE),
testPdv.getFloat(NPPSoundingRecord.LATITUDE));
if (closest == null
|| coordinate.distance(p) < coordinate
.distance(closest)) {
pdv = testPdv;
closest = p;
}
}
if (pdv == null) {
return null;
}
List<NcSoundingLayer> layers = getSoundingLayers(pdv);
Collections.sort(layers,
NsharpDataHandling.reversePressureHeightWindComparator());
// We have to interpolate everything so that height,temperature, and
// dewpoint are available on all levels.
interpolateHeight(layers);
interpolateTemperature(layers);
interpolateDewpoint(layers);
Iterator<NcSoundingLayer> iter = layers.iterator();
while (iter.hasNext()) {
NcSoundingLayer layer = iter.next();
if (layer.getPressure() < 0) {
iter.remove();
} else if (layer.getGeoHeight() < 0) {
// TODO: Needed?
// iter.remove();
} else if (layer.getTemperature() < -300) {
iter.remove();
} else if (layer.getDewpoint() < -300) {
iter.remove();
}
}
NcSoundingProfile profile = new NcSoundingProfile();
profile.setSoundingLyLst(layers);
// TODO populate other fields in profile
NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile));
cube.setRtnStatus(QueryStatus.OK);
return cube;
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
return null;
}
/**
* @param pdv
* @return
*/
protected abstract List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
throws VizException;
private static void interpolateHeight(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getGeoHeight() < 0) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateTemperature(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getTemperature() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getTemperature()
- layerBelow.getTemperature();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateDewpoint(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getDewpoint() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
// convert h2o in g/kg and pressure in hPa to dewpoint in kelvin.
protected static float convertH2OtoDewpoint(float h2o, float pressure) {
double eee = pressure * h2o / (622.0 + 0.378 * h2o);
double b = 26.66082 - Math.log(eee);
return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048);
}
// convert h2o in g/kg and pressure in hPa to relative humidity.
protected static float convertH20ToRelativeHumidity(float h20,
float temperature, float pressure) {
double a = 22.05565;
double b = 0.0091379024;
double c = 6106.396;
double epsilonx1k = 622.0;
double shxDenom = h20 * 0.378;
shxDenom += epsilonx1k;
double tDenom = -b * temperature;
tDenom += a;
tDenom -= c / temperature;
double RH = pressure * h20;
RH /= shxDenom;
RH /= Math.exp(tDenom);
return (float) RH;
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.npp.crimss.map;
package com.raytheon.uf.viz.npp.sounding.rsc;
import java.util.Collection;
@ -28,14 +28,14 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.input.InputAdapter;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Input manager for the CrimssMapResource
* Input handler for npp sounding availability resource
*
* <pre>
*
@ -43,7 +43,7 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 9, 2012 mschenke Initial creation
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
@ -51,28 +51,24 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
public class CrimssMapInputManager extends InputAdapter {
public class NPPSoundingMapInputHandler extends InputAdapter {
private NPPSoundingMapResource resource;
private Cursor handCursor;
private Cursor arrowCursor;
private CrimssMapResource resource;
private CrimssRecord closestRecord;
private NPPSoundingRecord closestRecord;
private int downX, downY;
public CrimssMapInputManager(CrimssMapResource resource) {
public NPPSoundingMapInputHandler(NPPSoundingMapResource resource) {
this.resource = resource;
Display display = Display.getCurrent();
handCursor = new Cursor(display, SWT.CURSOR_HAND);
arrowCursor = new Cursor(display, SWT.CURSOR_ARROW);
}
public void dispose() {
handCursor.dispose();
arrowCursor.dispose();
}
/*
@ -86,12 +82,13 @@ public class CrimssMapInputManager extends InputAdapter {
closestRecord = null;
if (resource.isEditable()) {
Collection<CrimssRecord> records = resource.getCurrentRecords();
Collection<NPPSoundingRecord> records = resource
.getCurrentRecords();
if (records != null) {
double radius = resource.getRadius();
Coordinate c = new Coordinate(x, y);
double bestDist = Double.MAX_VALUE;
for (CrimssRecord record : records) {
for (NPPSoundingRecord record : records) {
double lat = record.getLatitude();
double lon = record.getLongitude();
double[] pixel = resource.getResourceContainer()
@ -107,7 +104,7 @@ public class CrimssMapInputManager extends InputAdapter {
}
if (wasClosest && closestRecord == null) {
getShell().setCursor(arrowCursor);
getShell().setCursor(null);
} else if (!wasClosest && closestRecord != null) {
getShell().setCursor(handCursor);
}
@ -159,7 +156,7 @@ public class CrimssMapInputManager extends InputAdapter {
@Override
public boolean handleMouseExit(Event event) {
closestRecord = null;
getShell().setCursor(arrowCursor);
getShell().setCursor(null);
return super.handleMouseExit(event);
}

View file

@ -17,26 +17,25 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.npp.crimss.map;
package com.raytheon.uf.viz.npp.sounding.rsc;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.DrawableCircle;
@ -53,7 +52,6 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
@ -61,7 +59,7 @@ import com.raytheon.viz.ui.input.EditableManager;
import com.vividsolutions.jts.geom.Coordinate;
/**
* TODO Add Description
* Sounding available resource. Draws points on map where data is available
*
* <pre>
*
@ -69,66 +67,72 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 7, 2011 bsteffen Initial creation
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
* @author bsteffen
* @author mschenke
* @version 1.0
*/
public class CrimssMapResource extends
AbstractVizResource<CrimssMapResourceData, IMapDescriptor> {
public class NPPSoundingMapResource extends
AbstractVizResource<NPPSoundingMapResourceData, IMapDescriptor> {
private CrimssMapInputManager inputManager;
private NPPSoundingMapInputHandler inputManager;
private Map<DataTime, Set<CrimssRecord>> records = new HashMap<DataTime, Set<CrimssRecord>>();
private Collection<NPPSoundingRecord> allRecords = new ArrayList<NPPSoundingRecord>();
protected CrimssMapResource(CrimssMapResourceData resourceData,
private Map<DataTime, Collection<NPPSoundingRecord>> groupedRecords = new HashMap<DataTime, Collection<NPPSoundingRecord>>();
/**
* @param resourceData
* @param loadProperties
*/
protected NPPSoundingMapResource(NPPSoundingMapResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
this.inputManager = new CrimssMapInputManager(this);
this.inputManager = new NPPSoundingMapInputHandler(this);
this.dataTimes = new ArrayList<DataTime>();
getCapability(EditableCapability.class).setEditable(true);
resourceData.addChangeListener(new IResourceDataChanged() {
@Override
public void resourceChanged(ChangeType type, Object object) {
if (type == ChangeType.DATA_UPDATE) {
if (object instanceof PluginDataObject[]) {
for (PluginDataObject pdo : (PluginDataObject[]) object) {
addRecord((CrimssRecord) pdo);
}
addRecords((PluginDataObject[]) object);
}
}
}
});
}
Collection<CrimssRecord> getCurrentRecords() {
return records.get(descriptor.getTimeForResource(this));
Collection<NPPSoundingRecord> getCurrentRecords() {
return groupedRecords.get(descriptor.getTimeForResource(this));
}
public void addRecord(CrimssRecord record) {
DataTime time = record.getDataTime();
BinOffset binOffset = resourceData.getBinOffset();
if (binOffset != null) {
time = binOffset.getNormalizedTime(time);
public synchronized void addRecords(PluginDataObject... records) {
for (PluginDataObject record : records) {
if (record instanceof NPPSoundingRecord) {
if (allRecords.contains(record) == false) {
allRecords.add((NPPSoundingRecord) record);
}
}
}
Set<CrimssRecord> pdos = this.records.get(time);
if (pdos == null) {
pdos = new HashSet<CrimssRecord>();
this.records.put(time, pdos);
}
if (!this.dataTimes.contains(time)) {
this.dataTimes.add(time);
}
pdos.add(record);
Map<DataTime, Collection<NPPSoundingRecord>> groupedRecords = resourceData
.groupRecordTimes(allRecords);
List<DataTime> dataTimes = new ArrayList<DataTime>(
groupedRecords.keySet());
Collections.sort(dataTimes);
this.dataTimes = dataTimes;
this.groupedRecords = groupedRecords;
}
@Override
public void remove(DataTime dataTime) {
records.remove(dataTime);
public synchronized void remove(DataTime dataTime) {
Collection<NPPSoundingRecord> records = groupedRecords.remove(dataTime);
if (records != null) {
allRecords.removeAll(records);
}
super.remove(dataTime);
}
@ -145,20 +149,21 @@ public class CrimssMapResource extends
if (time == null) {
return;
}
Set<CrimssRecord> records = this.records.get(time);
Collection<NPPSoundingRecord> records = this.groupedRecords.get(time);
if (records == null) {
return;
}
RGB color = getCapability(ColorableCapability.class).getColor();
List<DrawableCircle> circles = new ArrayList<DrawableCircle>(
records.size());
for (CrimssRecord record : records) {
for (NPPSoundingRecord record : records) {
double lat = record.getLatitude();
double lon = record.getLongitude();
double[] pixel = descriptor.worldToPixel(new double[] { lon, lat });
DrawableCircle circle = new DrawableCircle();
circle.setCoordinates(pixel[0], pixel[1]);
circle.screenRadius = getRadius() - 1;
circle.screenRadius = getRadius();
circle.numberOfPoints = (int) (circle.screenRadius * 4);
circle.basics.color = color;
circle.filled = true;
circles.add(circle);
@ -183,11 +188,20 @@ public class CrimssMapResource extends
}
double getRadius() {
return 8 * getCapability(MagnificationCapability.class)
return 5 * getCapability(MagnificationCapability.class)
.getMagnification();
}
void loadSoundingResource(CrimssRecord record) {
@Override
public String getName() {
return resourceData.getResourceName() + " Availability";
}
/**
* @param closestRecord
*/
void loadSoundingResource(NPPSoundingRecord record) {
// Build metadata map for sounding resource
HashMap<String, RequestConstraint> metadataMap = new HashMap<String, RequestConstraint>(
resourceData.getMetadataMap());
RequestConstraint rc = new RequestConstraint(null,
@ -195,22 +209,24 @@ public class CrimssMapResource extends
rc.setBetweenValueList(new String[] {
String.valueOf(record.getLongitude() - 0.01),
String.valueOf(record.getLongitude() + 0.01) });
metadataMap.put(CrimssRecord.LONGITUDE, rc);
metadataMap.put(NPPSoundingRecord.LONGITUDE, rc);
rc = new RequestConstraint(null, ConstraintType.BETWEEN);
rc.setBetweenValueList(new String[] {
String.valueOf(record.getLatitude() - 0.01),
String.valueOf(record.getLatitude() + 0.01) });
metadataMap.put(CrimssRecord.LATITUDE, rc);
CrimssNSharpResourceData resourceData = new CrimssNSharpResourceData();
resourceData.setCoordinate(new Coordinate(record.getLongitude(), record
.getLatitude()));
resourceData.setPointName(String.format("CrIMSS-%.2f,%.2f",
record.getLongitude(), record.getLatitude()));
resourceData.setMetadataMap(metadataMap);
metadataMap.put(NPPSoundingRecord.LATITUDE, rc);
// Construct nsharp resource data for loading
AbstractNPPNSharpResourceData nsResourceData = resourceData
.newNsharpResourceData();
nsResourceData.setCoordinate(new Coordinate(record.getLongitude(),
record.getLatitude()));
nsResourceData.setMetadataMap(metadataMap);
ResourcePair pair = new ResourcePair();
pair.setResourceData(resourceData);
pair.setResourceData(nsResourceData);
pair.setLoadProperties(new LoadProperties());
NsharpSkewTPaneDisplay display = new NsharpSkewTPaneDisplay();
display.setDescriptor(new NsharpSkewTPaneDescriptor());
display.getDescriptor().getResourceList().add(pair);
String editorId = DescriptorMap.getEditorId(display.getDescriptor()
.getClass().getName());
@ -221,10 +237,4 @@ public class CrimssMapResource extends
Job j = new BundleProductLoader(editor, b);
j.schedule();
}
@Override
public String getName() {
return "CrIMSS Availability";
}
}

View file

@ -0,0 +1,161 @@
/**
* 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.viz.npp.sounding.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.npp.AbstractNppResourceData;
/**
* Resource data for availability map of npp soundings
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class NPPSoundingMapResourceData extends AbstractNppResourceData {
@XmlElement
private Class<? extends AbstractNPPNSharpResourceData> nsharpResourceData;
@XmlElement
private String resourceName;
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties,
* com.raytheon.uf.viz.core.rsc.PluginDataObject[])
*/
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
NPPSoundingMapResource resource = new NPPSoundingMapResource(this,
loadProperties);
if (objects instanceof PluginDataObject[]) {
resource.addRecords((PluginDataObject[]) objects);
}
return resource;
}
/**
* @return the nsharpResourceData
*/
public Class<? extends AbstractNPPNSharpResourceData> getNsharpResourceData() {
return nsharpResourceData;
}
/**
* @param nsharpResourceData
* the nsharpResourceData to set
*/
public void setNsharpResourceData(
Class<? extends AbstractNPPNSharpResourceData> nsharpResourceData) {
this.nsharpResourceData = nsharpResourceData;
}
/**
* @return the resourceName
*/
public String getResourceName() {
return resourceName;
}
/**
* @param resourceName
* the resourceName to set
*/
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
public AbstractNPPNSharpResourceData newNsharpResourceData() {
try {
return getNsharpResourceData().newInstance();
} catch (Exception e) {
throw new RuntimeException("Unable to create new instance of: "
+ getNsharpResourceData());
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime
* result
+ ((nsharpResourceData == null) ? 0 : nsharpResourceData
.hashCode());
result = prime * result
+ ((resourceName == null) ? 0 : resourceName.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
NPPSoundingMapResourceData other = (NPPSoundingMapResourceData) obj;
if (nsharpResourceData == null) {
if (other.nsharpResourceData != null)
return false;
} else if (!nsharpResourceData.equals(other.nsharpResourceData))
return false;
if (resourceName == null) {
if (other.resourceName != null)
return false;
} else if (!resourceName.equals(other.resourceName))
return false;
return true;
}
}

View file

@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.derivparam;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.viz.alerts;bundle-version="1.12.1174"
com.raytheon.viz.alerts;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Imagery" fileName="menus/npp/viirs/viirsMenuItems.xml"/>
</menuContributionFile>

View file

@ -19,7 +19,6 @@
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="separator" id="beforeVIIRS" visible="false"/>
<contribute xsi:type="titleItem" titleText="------ VIIRS ------" id="ImageryLine"/>
<contribute xsi:type="subMenu" menuText="CONUS Imagery" id="CONUSid">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml">
@ -36,5 +35,4 @@
<substitute key="region" value="Pacific"/>
</contribute>
</contribute>
<contribute xsi:type="separator" id="afterVIIRS" visible="false"/>
</menuTemplate>

View file

@ -35,6 +35,7 @@ import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 30, 2012 mschenke Initial creation
* Apr 8, 2013 1293 bkowal Removed references to hdffileid.
*
* </pre>
*
@ -55,8 +56,6 @@ public class VIIRSRequestableDataRecord extends VIIRSDataRecord {
boolean channelsSame = true;
Double lastWavelength = null;
boolean wavelengthsSame = true;
Integer lastHdf5FileId = null;
boolean hdf5FileIdsSame = true;
String lastChannelType = null;
boolean channelTypeSame = true;
// We will build ourself from our base records, anything that isn't
@ -73,7 +72,6 @@ public class VIIRSRequestableDataRecord extends VIIRSDataRecord {
lastChannelType = record.getChannelType();
lastChannel = record.getChannel();
lastWavelength = record.getWavelength();
lastHdf5FileId = record.getHdfFileId();
} else {
if (channelTypeSame
&& equals(lastChannelType, record.getChannelType()) == false) {
@ -87,10 +85,6 @@ public class VIIRSRequestableDataRecord extends VIIRSDataRecord {
&& equals(lastWavelength, record.getWavelength()) == false) {
wavelengthsSame = false;
}
if (hdf5FileIdsSame
&& equals(lastHdf5FileId, record.getHdfFileId()) == false) {
hdf5FileIdsSame = false;
}
if (record.getLevels() < getLevels()) {
// We want minimum levels of all base records
setLevels(record.getLevels());
@ -108,9 +102,6 @@ public class VIIRSRequestableDataRecord extends VIIRSDataRecord {
if (wavelengthsSame) {
setWavelength(lastWavelength);
}
if (hdf5FileIdsSame) {
setHdfFileId(lastHdf5FileId);
}
setParameter(requestableData.getParameter());
try {
constructDataURI();

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 30, 2011 mschenke Initial creation
* Apr 04, 2013 djohnson Remove color import.
*
* </pre>
*

View file

@ -19,33 +19,18 @@
**/
package com.raytheon.uf.viz.npp.viirs.rsc;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.npp.AbstractNppResourceData;
/**
* VIIRS Resource data
@ -66,38 +51,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class VIIRSResourceData extends AbstractRequestableResourceData {
private static class DataTimeIterator<T extends PluginDataObject>
implements Iterator<DataTime> {
private Iterator<T> pdoIter;
private T lastAccesed;
private DataTimeIterator(Iterator<T> pdoIter) {
this.pdoIter = pdoIter;
}
@Override
public boolean hasNext() {
return pdoIter.hasNext();
}
@Override
public DataTime next() {
lastAccesed = pdoIter.next();
return lastAccesed.getDataTime();
}
@Override
public void remove() {
pdoIter.remove();
}
}
@XmlElement
private int groupTimeRangeMinutes = 3;
public class VIIRSResourceData extends AbstractNppResourceData {
/*
* (non-Javadoc)
@ -119,176 +73,4 @@ public class VIIRSResourceData extends AbstractRequestableResourceData {
return new VIIRSResource(this, loadProperties, viirsRecords);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* requestPluginDataObjects(java.util.Collection)
*/
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {
List<DataTime> timesToLoad = new ArrayList<DataTime>(loadSet);
Collections.sort(timesToLoad);
DataTime first = timesToLoad.get(0);
DataTime last = timesToLoad.get(timesToLoad.size() - 1);
Map<String, RequestConstraint> requestMap = new HashMap<String, RequestConstraint>(
getMetadataMap());
RequestConstraint timeConst = new RequestConstraint();
timeConst.setConstraintType(ConstraintType.BETWEEN);
timeConst.setBetweenValueList(new String[] {
new DataTime(first.getValidPeriod().getStart()).toString(),
new DataTime(last.getValidPeriod().getEnd()).toString() });
requestMap.put("dataTime.refTime", timeConst);
LayerProperty property = new LayerProperty();
property.setEntryQueryParameters(requestMap, false);
property.setNumberOfImages(9999);
List<Object> pdos = DataCubeContainer.getData(property, 60000);
List<PluginDataObject> finalList = new ArrayList<PluginDataObject>(
pdos != null ? pdos.size() : 0);
if (pdos != null) {
for (Object obj : pdos) {
PluginDataObject pdo = (PluginDataObject) obj;
for (DataTime dt : loadSet) {
if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) {
finalList.add(pdo);
break;
}
}
}
Collections.sort(finalList, layerComparator);
}
return finalList.toArray(new PluginDataObject[finalList.size()]);
}
public static boolean withinRange(TimeRange range, DataTime time) {
long refTime = time.getMatchRef();
return range.getStart().getTime() <= refTime
&& range.getEnd().getTime() >= refTime;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* getAvailableTimes()
*/
@Override
public DataTime[] getAvailableTimes() throws VizException {
Collection<DataTime> dts = groupTimes(Arrays.asList(super
.getAvailableTimes()));
return dts.toArray(new DataTime[dts.size()]);
}
/**
* Group times for a {@link PluginDataObject} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param records
* @return
*/
public <T extends PluginDataObject> Map<DataTime, Collection<T>> groupRecordTimes(
Collection<T> records) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
Map<DataTime, Collection<T>> grouped = new HashMap<DataTime, Collection<T>>();
Queue<T> objects = new ArrayDeque<T>(records);
while (objects.size() > 0) {
T record = objects.remove();
DataTime current = record.getDataTime();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
List<T> group = new ArrayList<T>();
while (curr != null) {
prev = curr;
DataTimeIterator<T> iter = new DataTimeIterator<T>(
objects.iterator());
curr = match(iter, current.getValidPeriod(), groupTimeInMillis);
if (curr != null) {
group.add(iter.lastAccesed);
}
}
grouped.put(new DataTime(prev.getStart().getTime(), prev), group);
}
return grouped;
}
/**
* Group the {@link DataTime} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param dataTimes
* @return
*/
public Collection<DataTime> groupTimes(Collection<DataTime> dataTimes) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
List<DataTime> grouped = new ArrayList<DataTime>(dataTimes.size());
Queue<DataTime> objects = new ArrayDeque<DataTime>(dataTimes);
while (objects.size() > 0) {
DataTime current = objects.remove();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
while (curr != null) {
prev = curr;
curr = match(objects.iterator(), current.getValidPeriod(),
groupTimeInMillis);
}
grouped.add(new DataTime(prev.getStart().getTime(), prev));
}
return grouped;
}
private TimeRange match(Iterator<DataTime> iter, TimeRange time,
long groupTimeInMillis) {
long startT = time.getStart().getTime();
long endT = time.getEnd().getTime();
while (iter.hasNext()) {
DataTime dt = iter.next();
TimeRange dtRange = dt.getValidPeriod();
long s = dtRange.getStart().getTime();
long e = dtRange.getEnd().getTime();
long startCheck = s - groupTimeInMillis;
long endCheck = e + groupTimeInMillis;
if ((startT <= startCheck && endT >= startCheck)
|| (startCheck <= startT && endCheck >= startT)) {
iter.remove();
return new TimeRange(Math.min(s, startT), Math.max(e, endT));
}
}
return null;
}
/**
* @return the groupTimeRangeMinutes
*/
public int getGroupTimeRangeMinutes() {
return groupTimeRangeMinutes;
}
/**
* @param groupTimeRangeMinutes
* the groupTimeRangeMinutes to set
*/
public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) {
this.groupTimeRangeMinutes = groupTimeRangeMinutes;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java
* .lang.Object)
*/
@Override
public void update(Object updateData) {
super.update(updateData);
invalidateAvailableTimesCache();
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.opengis</name>
<name>com.raytheon.uf.viz.npp</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,4 +1,4 @@
#Thu Dec 02 10:55:26 CST 2010
#Tue Jan 08 13:23:52 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

View file

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Viz
Bundle-SymbolicName: com.raytheon.uf.viz.npp
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.npp

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -20,7 +20,8 @@
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" id="NPPProducts" menuText="NPP Products">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsMenuItems.xml"/>
<contribute xsi:type="subinclude" fileName="menus/npp/crimss/crimssMenuItems.xml"/>
<contribute xsi:type="separator" id="Imagery" visible="false"/>
<contribute xsi:type="titleItem" id="SoundingsTitle" titleText="------ Soundings ------"/>
<contribute xsi:type="separator" id="Soundings" visible="false"/>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,269 @@
/**
* 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.viz.npp;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
/**
* Abstract resource data for all NPP data. Groups frame times close together
* (within {@link #groupTimeRangeMinutes} minutes).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 8, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractNppResourceData extends
AbstractRequestableResourceData {
private static class DataTimeIterator<T extends PluginDataObject>
implements Iterator<DataTime> {
private Iterator<T> pdoIter;
private T lastAccesed;
private DataTimeIterator(Iterator<T> pdoIter) {
this.pdoIter = pdoIter;
}
@Override
public boolean hasNext() {
return pdoIter.hasNext();
}
@Override
public DataTime next() {
lastAccesed = pdoIter.next();
return lastAccesed.getDataTime();
}
@Override
public void remove() {
pdoIter.remove();
}
}
@XmlElement
private int groupTimeRangeMinutes = 15;
/**
* @return the groupTimeRangeMinutes
*/
public int getGroupTimeRangeMinutes() {
return groupTimeRangeMinutes;
}
/**
* @param groupTimeRangeMinutes
* the groupTimeRangeMinutes to set
*/
public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) {
this.groupTimeRangeMinutes = groupTimeRangeMinutes;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* requestPluginDataObjects(java.util.Collection)
*/
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {
List<DataTime> timesToLoad = new ArrayList<DataTime>(loadSet);
Collections.sort(timesToLoad);
DataTime first = timesToLoad.get(0);
DataTime last = timesToLoad.get(timesToLoad.size() - 1);
Map<String, RequestConstraint> requestMap = new HashMap<String, RequestConstraint>(
getMetadataMap());
RequestConstraint timeConst = new RequestConstraint();
timeConst.setConstraintType(ConstraintType.BETWEEN);
timeConst.setBetweenValueList(new String[] {
new DataTime(first.getValidPeriod().getStart()).toString(),
new DataTime(last.getValidPeriod().getEnd()).toString() });
requestMap.put("dataTime.refTime", timeConst);
LayerProperty property = new LayerProperty();
property.setEntryQueryParameters(requestMap, false);
property.setNumberOfImages(9999);
List<Object> pdos = DataCubeContainer.getData(property, 60000);
List<PluginDataObject> finalList = new ArrayList<PluginDataObject>(
pdos != null ? pdos.size() : 0);
if (pdos != null) {
for (Object obj : pdos) {
PluginDataObject pdo = (PluginDataObject) obj;
for (DataTime dt : loadSet) {
if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) {
finalList.add(pdo);
break;
}
}
}
Collections.sort(finalList, layerComparator);
}
return finalList.toArray(new PluginDataObject[finalList.size()]);
}
public static boolean withinRange(TimeRange range, DataTime time) {
long refTime = time.getMatchRef();
return range.getStart().getTime() <= refTime
&& range.getEnd().getTime() >= refTime;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* getAvailableTimes()
*/
@Override
public DataTime[] getAvailableTimes() throws VizException {
Collection<DataTime> dts = groupTimes(Arrays.asList(super
.getAvailableTimes()));
return dts.toArray(new DataTime[dts.size()]);
}
/**
* Group times for a {@link PluginDataObject} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param records
* @return
*/
public <T extends PluginDataObject> Map<DataTime, Collection<T>> groupRecordTimes(
Collection<T> records) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
Map<DataTime, Collection<T>> grouped = new HashMap<DataTime, Collection<T>>();
Queue<T> objects = new ArrayDeque<T>(records);
while (objects.size() > 0) {
T record = objects.remove();
DataTime current = record.getDataTime();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
List<T> group = new ArrayList<T>();
while (curr != null) {
prev = curr;
DataTimeIterator<T> iter = new DataTimeIterator<T>(
objects.iterator());
curr = match(iter, prev, groupTimeInMillis);
if (curr != null) {
group.add(iter.lastAccesed);
}
}
grouped.put(new DataTime(prev.getStart().getTime(), prev), group);
}
return grouped;
}
/**
* Group the {@link DataTime} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param dataTimes
* @return
*/
public Collection<DataTime> groupTimes(Collection<DataTime> dataTimes) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
List<DataTime> grouped = new ArrayList<DataTime>(dataTimes.size());
Queue<DataTime> objects = new ArrayDeque<DataTime>(dataTimes);
while (objects.size() > 0) {
DataTime current = objects.remove();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
while (curr != null) {
prev = curr;
curr = match(objects.iterator(), prev, groupTimeInMillis);
}
grouped.add(new DataTime(prev.getStart().getTime(), prev));
}
return grouped;
}
private TimeRange match(Iterator<DataTime> iter, TimeRange time,
long groupTimeInMillis) {
long startT = time.getStart().getTime();
long endT = time.getEnd().getTime();
while (iter.hasNext()) {
DataTime dt = iter.next();
TimeRange dtRange = dt.getValidPeriod();
long s = dtRange.getStart().getTime();
long e = dtRange.getEnd().getTime();
long startCheck = s - groupTimeInMillis;
long endCheck = e + groupTimeInMillis;
if ((startT <= startCheck && endT >= startCheck)
|| (startCheck <= startT && endCheck >= startT)) {
iter.remove();
return new TimeRange(Math.min(s, startT), Math.max(e, endT));
}
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java
* .lang.Object)
*/
@Override
public void update(Object updateData) {
super.update(updateData);
invalidateAvailableTimesCache();
}
}

View file

@ -0,0 +1,30 @@
package com.raytheon.uf.viz.npp;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -7,6 +7,7 @@ Bundle-Activator: com.raytheon.uf.viz.spring.dm.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
org.springframework;bundle-version="2.5.6",
org.apache.commons.logging;bundle-version="1.1.1"
org.apache.commons.logging;bundle-version="1.1.1",
com.raytheon.uf.common.comm;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy

View file

@ -135,7 +135,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
// check HTTP Server
Text text = servicesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkServer(text.getText().trim(),
ConnectivityManager.checkHttpServer(text.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
@ -154,7 +154,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
// check Pypies Server
Text textPypies = pypiesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkServer(textPypies.getText().trim(),
ConnectivityManager.checkHttpServer(textPypies.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {

View file

@ -237,11 +237,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
}
private void validateServices() {
ConnectivityManager.checkServer(services, servicesCallback);
ConnectivityManager.checkHttpServer(services, servicesCallback);
}
private void validatePypies() {
ConnectivityManager.checkServer(pypies, pypiesCallback);
ConnectivityManager.checkHttpServer(pypies, pypiesCallback);
}
private void updateProxyEnabled() {

View file

@ -24,6 +24,8 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
@ -44,8 +46,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathElement;
/**
* Holds the information for all the menu items in the dialog
*
@ -56,7 +56,6 @@ import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathEl
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 15, 2011 mnash Initial creation
* Apr 10, 2013 DR 15185 D. Friedman Preserve tear-offs over perspective switches.
*
* </pre>
*
@ -64,7 +63,7 @@ import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathEl
* @version 1.0
*/
public class MenuItemComposite extends Composite {
public class MenuItemComposite extends Composite implements MenuListener {
private boolean separator = false;
@ -75,8 +74,6 @@ public class MenuItemComposite extends Composite {
// backing data for executing listeners
private MenuItem item;
private MenuPathElement itemPath;
private Image arrow = null;
private Image highlightedArrow = null;
@ -87,6 +84,8 @@ public class MenuItemComposite extends Composite {
private List<String> myPath;
private Menu topMostParent;
/**
* @param parent
* @param style
@ -109,13 +108,14 @@ public class MenuItemComposite extends Composite {
do {
myPath.add(toAdd.getText());
toAdd = parent.getParentItem();
topMostParent = parent;
parent = parent.getParentMenu();
} while (parent.getParentMenu() != null);
Collections.reverse(myPath);
topMostParent.addMenuListener(this);
item = it;
itemPath = new MenuPathElement(it);
String[] labels = item.getText().split("\t");
// handle for a separator menu item
@ -189,8 +189,6 @@ public class MenuItemComposite extends Composite {
*
*/
private void addItemListeners() {
if (item == null)
return;
if (updateListener != null) {
item.addListener(SWT.Modify, updateListener);
}
@ -211,11 +209,11 @@ public class MenuItemComposite extends Composite {
for (Control comp : firstItem.getParent().getParent()
.getChildren()) {
MenuItemComposite composite = (MenuItemComposite) comp;
if (composite.getItem().getText().equals(
if (composite.item.getText().equals(
((MenuItem) e.widget).getText())) {
if (composite.firstItem instanceof Button) {
((Button) composite.firstItem)
.setSelection(composite.getItem()
.setSelection(composite.item
.getSelection());
}
} else {
@ -235,7 +233,7 @@ public class MenuItemComposite extends Composite {
@Override
public void handleEvent(Event event) {
if (secondItem != null && !secondItem.isDisposed()) {
if (getItem() == event.data) {
if (item == event.data) {
if (((MenuItem) event.data).getText().split("\t").length > 1) {
((Label) secondItem)
.setText(((MenuItem) event.data).getText()
@ -379,8 +377,6 @@ public class MenuItemComposite extends Composite {
MouseAdapter mouseAdapter = new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
MenuItem item = getItem();
if (item.getMenu() != null) {
// This is item opens a submenu, get the y offset based on
// the location of the click
@ -424,7 +420,7 @@ public class MenuItemComposite extends Composite {
for (int i = 0; i < siblings.length; i++) {
final MenuItemComposite mic = (MenuItemComposite) siblings[i];
if (mic.separator == false
&& mic.getItem().getStyle() == SWT.RADIO) {
&& mic.item.getStyle() == SWT.RADIO) {
try {
MenuItemComposite parent = null;
// check whether a Label is clicked or a
@ -438,16 +434,16 @@ public class MenuItemComposite extends Composite {
// check that the radio groups match
if (mic.getData("radioGroup").equals(
parent.getData("radioGroup"))) {
if (!parent.getItem()
if (!parent.item
.getText()
.replaceAll("&", "")
.equals(mic.getItem().getText().replaceAll(
.equals(mic.item.getText().replaceAll(
"&", ""))) {
mic.getItem().setSelection(false);
mic.item.setSelection(false);
((Button) mic.firstItem)
.setSelection(false);
} else {
mic.getItem().setSelection(true);
mic.item.setSelection(true);
((Button) mic.firstItem).setSelection(true);
}
}
@ -480,6 +476,10 @@ public class MenuItemComposite extends Composite {
}
}
if (topMostParent != null) {
topMostParent.removeMenuListener(this);
}
super.dispose();
}
@ -489,40 +489,67 @@ public class MenuItemComposite extends Composite {
}
}
private MenuItem getItem() {
MenuItem item = getItemIfAvailable();
if (item == null)
throw new IllegalStateException(
String.format("Could not find target of tear-off menu item \"%s\"",
itemPath.getName()));
return item;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.swt.events.MenuListener#menuHidden(org.eclipse.swt.events
* .MenuEvent)
*/
@Override
public void menuHidden(MenuEvent e) {
if (item.isDisposed() == false) {
return;
}
private MenuItem getItemIfAvailable() {
if (item == null || item.isDisposed()) {
item = findItem();
// At some point we may need to check against the index as well but that
// is difficult because we don't know if the tear off menu item will/was
// in the menu when we were created/now so our index could be off by one
// very easily making it unreliable
Menu menu = topMostParent;
MenuItem myItem = null;
String last = myPath.get(myPath.size() - 1);
for (String path : myPath) {
if (menu != null) {
MenuItem[] items = menu.getItems();
for (int i = 0; i < items.length; ++i) {
MenuItem item = items[i];
if (path.equals(item.getText())) {
if (path == last) {
myItem = item;
} else {
menu = item.getMenu();
if (menu != null && menu.getItemCount() == 0) {
// Have to manually fill menu
for (Listener listener : menu
.getListeners(SWT.Show)) {
Event event = new Event();
event.type = SWT.Show;
event.widget = menu;
listener.handleEvent(event);
}
}
}
break;
}
}
}
}
if (myItem != null && myItem.isDisposed() == false) {
item = myItem;
addItemListeners();
}
return item;
}
private MenuItem findItem() {
Menu menu = getTargetMenu();
if (menu != null)
return TearOffMenuDialog.findItem(menu, itemPath);
else
return null;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.swt.events.MenuListener#menuShown(org.eclipse.swt.events.
* MenuEvent)
*/
@Override
public void menuShown(MenuEvent e) {
}
private Menu getTargetMenu() {
return getDialog().getTargetMenu();
}
private TearOffMenuDialog getDialog() {
return (TearOffMenuDialog) getShell().getData();
}
public void reconnect() {
getItemIfAvailable();
}
}

View file

@ -27,7 +27,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
@ -42,7 +41,6 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 5, 2011 mnash Initial creation
* Apr 10, 2013 DR 15185 D. Friedman Do not assume there is an active editor.
*
* </pre>
*
@ -90,10 +88,7 @@ public class PopupMenu {
mItem.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
IEditorPart editor = EditorUtil.getActiveEditor();
if (editor instanceof AbstractEditor) {
((AbstractEditor) editor).refresh();
}
((AbstractEditor) EditorUtil.getActiveEditor()).refresh();
}
});

View file

@ -19,12 +19,6 @@
**/
package com.raytheon.uf.viz.ui.menus.widgets.tearoff;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Point;
@ -59,7 +53,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Sep 14, 2011 mnash Initial creation
* Jan 09, 2013 1442 rferrel Add Simulated Time Change Listener.
* Apr 10, 2013 DR 15185 D. Friedman Preserve tear-offs over perspective switches.
*
* </pre>
*
@ -69,9 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class TearOffMenuDialog extends CaveSWTDialog {
private MenuPathElement[] menuPath;
private Menu menu;
private MenuItem[] items;
private ScrolledComposite scrolledComp;
@ -89,9 +80,8 @@ public class TearOffMenuDialog extends CaveSWTDialog {
public TearOffMenuDialog(Menu menu) {
super(VizWorkbenchManager.getInstance().getCurrentWindow().getShell(),
SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
this.menuPath = getMenuPath(menu);
this.menu = menu;
String text = menu.getParentItem().getText();
this.items = menu.getItems();
// handle for the & that makes key bindings
setText(text.replace("&", ""));
@ -99,7 +89,6 @@ public class TearOffMenuDialog extends CaveSWTDialog {
@Override
protected void initializeComponents(final Shell shell) {
shell.setData(this);
// allow for scrolling if necessary
scrolledComp = new ScrolledComposite(shell, SWT.V_SCROLL);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
@ -117,7 +106,6 @@ public class TearOffMenuDialog extends CaveSWTDialog {
// go through menu items and build MenuItemComposite for each item,
// which handles all the selection and color of the "MenuItem" in the
// dialog
MenuItem[] items = getTargetMenu().getItems();
int radioGroup = 0;
for (int i = 1; i < items.length; i++) {
MenuItem item = items[i];
@ -152,10 +140,11 @@ public class TearOffMenuDialog extends CaveSWTDialog {
int y = point.y;
shell.setLocation(x, y);
shell.addListener(SWT.Show, new Listener() {
// close the dialog on perspective change
shell.addListener(SWT.Hide, new Listener() {
@Override
public void handleEvent(Event event) {
updateItems();
close();
}
});
}
@ -215,156 +204,12 @@ public class TearOffMenuDialog extends CaveSWTDialog {
* Force update of item's display.
*/
private void updateItems() {
Menu menu = getMenuIfAvailable();
if (menu == null)
return;
for (MenuItemComposite mic : getMenuItemComposites())
mic.reconnect();
for (MenuItem item : menu.getItems()) {
// items[0] is the tear off object and is not in the dialog's display.
for (int index = 1; index < items.length; ++index) {
MenuItem item = items[index];
if (item.getData() instanceof BundleContributionItem) {
((BundleContributionItem) item.getData()).refreshText();
}
}
}
private List<MenuItemComposite> getMenuItemComposites() {
List<MenuItemComposite> result = new ArrayList<MenuItemComposite>();
for (Control c : fullComp.getChildren()) {
if (c instanceof MenuItemComposite)
result.add((MenuItemComposite) c);
}
return result;
}
/**
* Return the portion of a menu item's title that should not change over
* time
*
*/
private static String getCleanMenuItemText(String text) {
int pos = text.indexOf('\t');
if (pos >= 0)
return text.substring(0, pos);
else
return text;
}
private Menu getMenuIfAvailable() {
if (menu == null || menu.isDisposed()) {
menu = findMenu();
}
return menu;
}
/*package*/ Menu getTargetMenu() {
Menu menu = getMenuIfAvailable();
if (menu == null) {
throw new IllegalStateException(
String.format("Tear-off menu %s is not available", shell.getText()));
}
if (menu.getItems().length == 0)
tryToFillMenu(menu);
return menu;
}
private void tryToFillMenu(Menu menu) {
/*
* Menu may not have been created so call listeners. This still does
* not work if all of the menu items need the workbench window to be
* active in order to be enabled.
*/
Shell shell = this.shell.getParent().getShell();
shell.setActive();
while (shell.getDisplay().readAndDispatch()) {
// nothing
}
Event event = new Event();
event.type = SWT.Show;
menu.notifyListeners(SWT.Show, event);
event = new Event();
event.type = SWT.Hide;
menu.notifyListeners(SWT.Hide, event);
}
private Menu findMenu() {
/* NOTE: Assuming shell.getParent().getShell() is the workbench window. */
Menu container = shell.getParent().getShell().getMenuBar();
MenuPathElement lastPathElement = null;
for (int i = 0; i < menuPath.length; ++i) {
MenuItem mi = findItem(container, menuPath[i]);
if (mi == null)
return null;
Menu mim = mi.getMenu();
if (mim == null)
throw new IllegalStateException(String.format(
"Could not get target menu \"%s\" in %s",
menuPath[i].getName(), lastPathElement != null ?
'"' + lastPathElement.getName() + '"' : "menu bar"));
tryToFillMenu(mim);
container = mim;
lastPathElement = menuPath[i];
}
return container;
}
/**
* Identifies a specific item in an SWT menu. It has been observed that
* associated data of a menu item maintains the same identity during a CAVE
* session even if the MenuItem is recreated. However, the associated
* data is not always unique. Menu item text is used to differentiate.
*/
static class MenuPathElement {
Object data;
String cleanText;
public MenuPathElement(MenuItem item) {
data = item.getData();
cleanText = getCleanMenuItemText(item.getText());
}
public int getMatchLevel(MenuItem item) {
int level = 0;
if (item.getData() == data)
++level;
if (cleanText.equals(item.getText()))
++level;
return level;
}
public String getName() {
if (cleanText != null && cleanText.length() > 0)
return cleanText;
Object value = data;
if (value instanceof MenuManager)
value = ((MenuManager) value).getId();
else if (value instanceof ContributionItem)
value = ((ContributionItem) value).getId();
return String.valueOf(value);
}
}
/*package*/ static MenuItem findItem(Menu menu, MenuPathElement pe) {
MenuItem best = null;
int bestLevel = 0;
for (MenuItem item : menu.getItems()) {
int matchLevel = pe.getMatchLevel(item);
if (matchLevel > bestLevel) {
bestLevel = matchLevel;
best = item;
}
}
return best;
}
private static MenuPathElement[] getMenuPath(Menu menu) {
ArrayList<MenuPathElement> data = new ArrayList<MenuPathElement>();
while (menu != null) {
MenuItem mi = menu.getParentItem();
if (mi == null)
break;
data.add(new MenuPathElement(mi));
menu = menu.getParentMenu();
}
Collections.reverse(data);
return data.toArray(new MenuPathElement[data.size()]);
}
}

View file

@ -39,11 +39,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.viz.ui.VizWorkbenchManager;
/**
* Menu listener that adds item to menu which will open dialog which is the menu
*
@ -54,7 +49,6 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 14, 2011 mschenke Initial creation
* Apr 10, 2013 DR 15185 D. Friedman Preserve tear-offs over perspective switches.
*
* </pre>
*
@ -72,9 +66,6 @@ public class TearOffMenuListener implements IMenuListener2 {
public static final String TEAROFF_PREFERENCE_ID = "tearoffmenus";
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TearOffMenuListener.class);
private static boolean enabled;
static {
final IPreferenceStore store = com.raytheon.uf.viz.core.Activator
@ -103,7 +94,7 @@ public class TearOffMenuListener implements IMenuListener2 {
@Override
public void menuAboutToShow(final IMenuManager manager) {
register(manager.getItems(), this);
if (openDialogs.contains(getPerspectiveKey(manager)) == false) {
if (openDialogs.contains(getKey(manager)) == false) {
// We need to add our item to be first so we need to remove others
// then add ourself
IContributionItem[] items = manager.getItems();
@ -121,7 +112,7 @@ public class TearOffMenuListener implements IMenuListener2 {
*/
@Override
public void menuAboutToHide(IMenuManager manager) {
if (openDialogs.contains(getPerspectiveKey(manager)) == false) {
if (openDialogs.contains(getKey(manager)) == false) {
manager.remove(ID);
manager.remove(ACTION_ID);
unregister(manager.getItems(), this);
@ -146,16 +137,6 @@ public class TearOffMenuListener implements IMenuListener2 {
}
}
private Object getPerspectiveKey(IMenuManager manager) {
String perspectiveId = "";
try {
perspectiveId = VizWorkbenchManager.getInstance().getCurrentWindow().getActivePage().getPerspective().getId();
} catch (Exception e) {
statusHandler.handle(Priority.EVENTA, "Failed to get current perspective ID", e);
}
return perspectiveId + "::" + getKey(manager);
}
private static Object getKey(IMenuManager manager) {
Object key = manager;
if (manager.getId() != null) {
@ -234,18 +215,17 @@ public class TearOffMenuListener implements IMenuListener2 {
*/
@Override
public void run() {
final Object key = getPerspectiveKey(manager);
TearOffMenuDialog dialog = new TearOffMenuDialog(menu);
dialog.addListener(SWT.Dispose, new Listener() {
@Override
public void handleEvent(Event event) {
openDialogs.remove(key);
openDialogs.remove(getKey(manager));
manager.remove(ID);
manager.remove(ACTION_ID);
unregister(manager.getItems(), TearOffMenuListener.this);
}
});
openDialogs.add(key);
openDialogs.add(getKey(manager));
register(manager.getItems(), TearOffMenuListener.this);
dialog.open();
}

View file

@ -27,6 +27,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.bind.JAXB;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -50,6 +54,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.aviation.climatology.ClimateMenuDlg;
import com.raytheon.viz.aviation.model.ForecastModel;
@ -95,6 +100,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* file exists.
* 10/02/2012 1229 rferrel Made dialog non-blocking.
* 10/09/2012 1229 rferrel Changes for non-blocking TafMonitorDlg.
* 04/10/2013 1735 rferrel Changes for taf monitor speed up.
*
* </pre>
*
@ -186,11 +192,21 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
ForecastModel.getInstance().setBackupRestartUtility(this);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
return new GridLayout(1, false);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
font.dispose();
@ -211,6 +227,13 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
@ -271,6 +294,25 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
createLabel();
createList();
createComposite();
initAcarsSounding();
}
/**
* To speed up the display of the monitor this method starts up the Data
* Cube for the acarssounding inventory which can take over a second for the
* initial retrieval. This may cause blocking issues that slows the display
* of the monitor.
*/
private void initAcarsSounding() {
Job job = new Job("AviationDialog") {
@Override
protected IStatus run(IProgressMonitor monitor) {
DataCubeContainer.getInventory("acarssounding");
return Status.OK_STATUS;
}
};
job.schedule();
}
/**

View file

@ -221,7 +221,7 @@ public class CigVisByHourTabComp extends Composite implements ICigVisTabComp {
* Data to set.
*/
public void setCigVisData(CigVisDistDataManager data) {
data = data;
this.data = data;
cigVisCanvasComp.setCigVisData(data);
}

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.aviation.monitor;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -31,18 +32,21 @@ import com.raytheon.edex.plugin.ccfp.CcfpRecord;
import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
/**
* Utility functions for data requesting
* Utility functions for data requesting.
*
* <pre>
*
@ -50,6 +54,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 10, 2009 njensen Initial creation
* Apr 10, 2013 1735 rferrel Convert to ThinClient and DbQueryRequests.
*
* </pre>
*
@ -72,22 +77,24 @@ public class MonitorDataUtil {
* Get the lightning data newer than a particular time
*
* @param time
* @return
* @return records
*/
public static BinLightningRecord[] getLightningData(long time) {
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(BinLightningRecord.class);
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.put("pluginName", new RequestConstraint("binlightning"));
map.put("startTime", new RequestConstraint(SDF.format(new Date(time)),
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
LayerProperty lp = new LayerProperty();
lp.setNumberOfImages(999);
request.setConstraints(map);
request.setLimit(999);
try {
lp.setEntryQueryParameters(map);
List<Object> objs = Loader.loadData(lp, "select", 10000);
BinLightningRecord[] records = new BinLightningRecord[objs.size()];
for (int i = 0; i < records.length; i++) {
records[i] = (BinLightningRecord) objs.get(i);
}
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
BinLightningRecord[] records = response
.getEntityObjects(BinLightningRecord.class);
return records;
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
@ -96,39 +103,49 @@ public class MonitorDataUtil {
return new BinLightningRecord[0];
}
/**
* Obtain ccfp records greater then or equal to time.
*
* @param time
* @return records
*/
@SuppressWarnings("unchecked")
public static CcfpRecord[] getCcfpData(long time) {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.put("pluginName", new RequestConstraint("ccfp"));
map.put("dataTime.refTime",
new RequestConstraint(SDF.format(new Date(time)),
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
try {
String[] catalog = CatalogQuery.performQuery("dataTime", map);
String[] times = catalog;
DataTime[] dts = null;
Arrays.sort(catalog);
if (catalog.length > 3) {
dts = new DataTime[3];
dts[0] = new DataTime(catalog[catalog.length - 1]);
dts[1] = new DataTime(catalog[catalog.length - 2]);
dts[2] = new DataTime(catalog[catalog.length - 3]);
} else {
dts = new DataTime[times.length];
for (int i = 0; i < catalog.length; i++) {
dts[i] = new DataTime(catalog[catalog.length - i - 1]);
}
}
map.remove("dataTime.refTime");
LayerProperty lp = new LayerProperty();
lp.setNumberOfImages(999);
lp.setSelectedEntryTimes(dts);
TimeQueryRequest tqRequest = new TimeQueryRequest();
tqRequest.setPluginName("ccfp");
tqRequest.setQueryTerms(map);
lp.setEntryQueryParameters(map);
List<Object> objs = Loader.loadData(lp, "select", 10000);
CcfpRecord[] records = new CcfpRecord[objs.size()];
for (int i = 0; i < records.length; i++) {
records[i] = (CcfpRecord) objs.get(i);
List<DataTime> dtList = (List<DataTime>) ThriftClient
.sendRequest(tqRequest);
String[] dts = new String[dtList.size()];
for (int index = 0; index < dts.length; ++index) {
dts[index] = dtList.get(index).toString();
}
map.put("pluginName", new RequestConstraint("ccfp"));
Arrays.sort(dts, Collections.reverseOrder());
if (dts.length > 3) {
dts = Arrays.copyOf(dts, 3);
}
map.remove("dataTime.refTime");
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(CcfpRecord.class);
request.setLimit(999);
request.setConstraints(map);
RequestConstraint dataTimeRC = new RequestConstraint();
dataTimeRC.setConstraintType(ConstraintType.IN);
dataTimeRC.setConstraintValueList(dts);
request.addConstraint("dataTime", dataTimeRC);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
CcfpRecord[] records = response.getEntityObjects(CcfpRecord.class);
return records;
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
@ -138,6 +155,13 @@ public class MonitorDataUtil {
return new CcfpRecord[0];
}
/**
* Get the most recent radar vertical wind profile.
*
* @param radar
* @param time
* @return records
*/
public static RadarRecord[] getVerticalWindProfile(String radar, long time) {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.put("pluginName", new RequestConstraint("radar"));
@ -147,28 +171,37 @@ public class MonitorDataUtil {
map.put("icao", new RequestConstraint(radar.toLowerCase()));
map.put("mnemonic", new RequestConstraint("VWP"));
LayerProperty lp = new LayerProperty();
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(RadarRecord.class);
try {
lp.setEntryQueryParameters(map);
DataTime[] dt = lp.getEntryTimes();
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
map.remove("dataTime.refTime");
request.setConstraints(map);
if (dt.length > 0) {
lp.setSelectedEntryTimes(new DataTime[] { dt[dt.length - 1] });
}
List<Object> objs = Loader.loadData(lp, "select", 10000);
RadarRecord[] records = new RadarRecord[objs.size()];
for (int i = 0; i < records.length; i++) {
records[i] = (RadarRecord) objs.get(i);
request.addConstraint("dataTime",
new RequestConstraint(SDF.format(dt[0].getRefTime())));
}
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
RadarRecord[] records = response
.getEntityObjects(RadarRecord.class);
return records;
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
statusHandler.handle(Priority.ERROR,
"Error retrieving radar vertical wind profile data", e);
}
return null;
}
/**
* Get ACARS most recent sounding record for a station that is greater then
* or equal to time.
*
* @param stationId
* @param time
* @return records
*/
public static ACARSSoundingRecord[] getAcarsSoundingRecords(
String stationId, long time) {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
@ -179,24 +212,26 @@ public class MonitorDataUtil {
map.put("location.stationId",
new RequestConstraint(stationId.substring(1)));
LayerProperty lp = new LayerProperty();
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(ACARSSoundingRecord.class);
try {
lp.setEntryQueryParameters(map);
DataTime[] dt = lp.getEntryTimes();
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
map.remove("dataTime.refTime");
request.setConstraints(map);
if (dt.length > 0) {
lp.setSelectedEntryTimes(new DataTime[] { dt[dt.length - 1] });
}
List<Object> objs = Loader.loadData(lp, "select", 10000);
ACARSSoundingRecord[] records = new ACARSSoundingRecord[objs.size()];
for (int i = 0; i < records.length; i++) {
records[i] = (ACARSSoundingRecord) objs.get(i);
request.addConstraint("dataTime",
new RequestConstraint(SDF.format(dt[0].getRefTime())));
}
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
ACARSSoundingRecord[] records = response
.getEntityObjects(ACARSSoundingRecord.class);
return records;
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
statusHandler.handle(Priority.ERROR,
"Error retrieving Acars Sounding Records data", e);
}
return null;
}

View file

@ -112,7 +112,7 @@ public class PythonMonitorJob extends AbstractQueueJob<MonitorRequest> {
* Places request on static queue.
*
* @param req
* @return
* @return true if request is accepted.
*/
public static boolean offerRequest(MonitorRequest req) {
try {

View file

@ -101,7 +101,7 @@ import com.raytheon.viz.avnconfig.IStatusSettable;
*/
public class TafSiteComp {
/**
*
* Grid monitor class name.
*/
public static final String GRID_MONITOR_CLASS = "GridMonitor";

View file

@ -288,6 +288,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
currentDlg = this;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@ -297,6 +302,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
SiteGridManager.clear();
@ -304,6 +314,13 @@ public class TafMonitorDlg extends CaveSWTDialog implements
tveDlg.disposeDialog();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
@ -323,6 +340,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
});
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/
@Override
protected void preOpened() {
checkNow();

View file

@ -19,12 +19,9 @@
**/
package com.raytheon.viz.awipstools.ui.action;
import java.util.List;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.AwipsToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractMapToolAction;
@ -38,7 +35,6 @@ import com.raytheon.viz.awipstools.ui.layer.TimeOfArrivalLayer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 07DEC2007 #496 Eric Babin Initial Creation.
* Apr 12 2013 DR 16032 D. Friedman Make it work in multiple panes.
*
* </pre>
*
@ -49,6 +45,10 @@ import com.raytheon.viz.awipstools.ui.layer.TimeOfArrivalLayer;
public class TimeOfArrivalAction extends
AbstractMapToolAction<TimeOfArrivalLayer> {
private TimeOfArrivalLayer layer = null;
private AwipsToolsResourceData<TimeOfArrivalLayer> data = null;
/*
* (non-Javadoc)
*
@ -57,40 +57,22 @@ public class TimeOfArrivalAction extends
*/
@Override
protected AwipsToolsResourceData<TimeOfArrivalLayer> getResourceData() {
return new AwipsToolsResourceData<TimeOfArrivalLayer>(
if (data == null) {
data = new AwipsToolsResourceData<TimeOfArrivalLayer>(
TimeOfArrivalLayer.NAME, TimeOfArrivalLayer.class);
}
return data;
}
@Override
protected TimeOfArrivalLayer getResource(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
TimeOfArrivalLayer layer = getExistingResource();
if (layer == null)
return super.getResource(loadProperties, descriptor);
VizApp.runAsync( new Runnable() {
@Override
public void run() {
TimeOfArrivalLayer layer = getExistingResource();
if (layer != null) {
layer.makeEditableAndReopenDialog();
}
}
});
if (layer == null || layer.getStatus() == ResourceStatus.DISPOSED) {
layer = super.getResource(loadProperties, descriptor);
} else {
layer.reopenDialog();
}
return layer;
}
private TimeOfArrivalLayer getExistingResource() {
IDisplayPane[] panes = getSelectedPanes();
if (panes != null && panes.length > 0) {
List<TimeOfArrivalLayer> layers = null;
layers = panes[0].getDescriptor().getResourceList()
.getResourcesByTypeAsType(TimeOfArrivalLayer.class);
if (layers.size() > 0) {
return layers.get(0);
}
}
return null;
}
}

View file

@ -71,7 +71,6 @@ import com.raytheon.viz.awipstools.common.stormtrack.StormTrackUIManager;
import com.raytheon.viz.awipstools.ui.dialog.TimeOfArrivalDialog;
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.input.EditableManager;
import com.raytheon.viz.ui.input.InputAdapter;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
@ -99,7 +98,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* left-to-right if there is not enough room
* for the text to the left of the point.
* 15Mar2013 15693 mgamazaychikov Added magnification capability.
* Apr 12 2013 DR 16032 D. Friedman Make it work in multiple panes.
* </pre>
*
* @author mschenke
@ -258,6 +256,7 @@ public class TimeOfArrivalLayer extends AbstractStormTrackResource {
this.pdProps.setMaxDisplayWidth(TimeOfArrivalLayer.PD_MAX_WIDTH);
timeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
reopenDialog();
leadState = new LeadTimeState();
shell = VizWorkbenchManager.getInstance().getCurrentWindow().getShell();
@ -273,7 +272,6 @@ public class TimeOfArrivalLayer extends AbstractStormTrackResource {
if (container != null) {
container.registerMouseHandler(adapter);
}
reopenDialog();
}
@Override
@ -567,20 +565,20 @@ public class TimeOfArrivalLayer extends AbstractStormTrackResource {
*/
public void reopenDialog() {
// Open the dialog
VizApp.runAsync(new Runnable() {
if (dialog == null || dialog.getShell() == null
|| dialog.getShell().isDisposed()) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if (dialog == null || dialog.getShell() == null
|| dialog.getShell().isDisposed()) {
@Override
public void run() {
dialog = new TimeOfArrivalDialog(VizWorkbenchManager
.getInstance().getCurrentWindow().getShell(),
TimeOfArrivalLayer.this);
dialog.setBlockOnOpen(false);
dialog.open();
}
}
});
});
}
}
private void updateLeadTimeState() {
@ -680,9 +678,4 @@ public class TimeOfArrivalLayer extends AbstractStormTrackResource {
}
leadState.changed = false;
}
public void makeEditableAndReopenDialog() {
EditableManager.makeEditable(this, true);
reopenDialog();
}
}

Some files were not shown because too many files have changed in this diff Show more