Omaha #3393 Add request/response for RadarDataRecord. Remove broken RadarDao override. Convert a2_rad scripts.

Change-Id: Ie3ea761920c1ecec233e1fc586f3cbcd5914f1c6

Former-commit-id: 10f163ec37 [formerly f70776903c] [formerly 2fcc25bb9b] [formerly 10f163ec37 [formerly f70776903c] [formerly 2fcc25bb9b] [formerly 8fdc47855e [formerly 2fcc25bb9b [formerly 44ca6fb8a26cc9af7267ce635a200eb3c26ce9f8]]]]
Former-commit-id: 8fdc47855e
Former-commit-id: 7a50028eff [formerly b1fbb4e678] [formerly 774f44cab9d2b4fee8d681e9226c84c8f3a3bc47 [formerly f2be9c044e]]
Former-commit-id: 68fbb736180cfea0a6a71068cb181a3ebac73827 [formerly d398fdca21]
Former-commit-id: d68602eadd
This commit is contained in:
Nathan Bowler 2014-08-12 10:32:24 -04:00
parent 80bb517683
commit d0df1e49ce
20 changed files with 1766 additions and 657 deletions

View file

@ -15,6 +15,12 @@
<constructor-arg ref="getRadarDataTreeHandler"/>
</bean>
<bean id="getRadarDataRecordHandler" class="com.raytheon.edex.plugin.radar.handler.GetRadarDataRecordHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.radar.request.GetRadarDataRecordRequest"/>
<constructor-arg ref="getRadarDataRecordHandler"/>
</bean>
<bean id="radarMenuUtil" class="com.raytheon.edex.plugin.radar.util.RadarMenuUtil" />
<bean id="radarMenus" factory-bean="menuCreationRegistry" factory-method="register">
<constructor-arg value="radar"/>

View file

@ -30,6 +30,8 @@ package com.raytheon.edex.plugin.radar.dao;
* Feb 06, 2009 1990 bphillip Initial creation
* Mar 18, 2013 1804 bsteffen Reduce useless data stored in radar hdf5
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Aug 14, 2014 3393 nabowle Remove broken getFullRecord override.
* Aug 19, 2014 3393 nabowle Default constructor.
*
* </pre>
*
@ -37,7 +39,6 @@ package com.raytheon.edex.plugin.radar.dao;
* @version 1.0
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -48,10 +49,6 @@ import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.RadarStoredData;
import com.raytheon.uf.common.dataplugin.radar.level3.GSMBlock.GSMMessage;
import com.raytheon.uf.common.dataplugin.radar.level3.GraphicBlock;
import com.raytheon.uf.common.dataplugin.radar.level3.SymbologyBlock;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.MapValues;
import com.raytheon.uf.common.dataplugin.radar.util.RadarDataRetriever;
import com.raytheon.uf.common.datastorage.IDataStore;
@ -62,14 +59,21 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.database.plugin.PluginDao;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
public class RadarDao extends PluginDao {
/**
* Creates a new radar dao. Equivalent to RadarDao("radar").
*
* @throws PluginException
* If the dao cannot be initialized
*/
public RadarDao() throws PluginException {
super("radar");
}
/**
* Creates a new radar dao
*
@ -270,38 +274,6 @@ public class RadarDao extends PluginDao {
return retVal;
}
@Override
public PluginDataObject[] getFullRecord(DatabaseQuery query, int tile)
throws PluginException {
PluginDataObject[] queryResults = getMetadata(query);
for (PluginDataObject obj : queryResults) {
RadarRecord record = (RadarRecord) obj;
IDataRecord[] hdf5Data = getHDF5Data(record, tile);
record.setMessageData(hdf5Data[0].getDataObject());
record.setAngleData((float[]) hdf5Data[1].getDataObject());
record.setThresholds((short[]) hdf5Data[2].getDataObject());
record.setProductDependentValues((short[]) hdf5Data[8]
.getDataObject());
record.setProductVals((HashMap<RadarConstants.MapValues, Map<String, Map<RadarConstants.MapValues, String>>>) hdf5Data[5]
.getDataObject());
record.setMapRecordVals((HashMap<RadarConstants.MapValues, Map<RadarConstants.MapValues, String>>) hdf5Data[6]);
record.setGsmMessage((GSMMessage) hdf5Data[7].getDataObject());
try {
record.setSymbologyBlock((SymbologyBlock) SerializationUtil
.transformFromThrift((byte[]) hdf5Data[3]
.getDataObject()));
record.setGraphicBlock((GraphicBlock) SerializationUtil
.transformFromThrift((byte[]) hdf5Data[4]
.getDataObject()));
} catch (SerializationException e) {
throw new PluginException(
"Error deserializing symbology block", e);
}
}
return queryResults;
}
public void populateData(RadarRecord record) throws Exception {
RadarDataRetriever.populateRadarRecord(getDataStore(record), record);

View file

@ -0,0 +1,132 @@
/**
* 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.edex.plugin.radar.handler;
import java.util.List;
import com.raytheon.edex.plugin.radar.dao.RadarDao;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.request.GetRadarDataRecordRequest;
import com.raytheon.uf.common.dataplugin.radar.response.GetRadarDataRecordResponse;
import com.raytheon.uf.common.dataplugin.radar.response.RadarDataRecord;
import com.raytheon.uf.common.dataquery.db.QueryParam.QueryOperand;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
/**
* Request handler for {@link GetRadarDataRecordRequest}s.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 7, 2014 3393 nabowle Initial creation
*
* </pre>
*
* @author nabowle
* @version 1.0
*/
public class GetRadarDataRecordHandler implements
IRequestHandler<GetRadarDataRecordRequest> {
public static final String ENTITY = RadarRecord.class.getName().toString();
/**
* Constructor.
*/
public GetRadarDataRecordHandler() {
super();
}
/*
* (non-Javadoc)
*
* @see
* IRequestHandler#handleRequest(com.raytheon.uf.common.serialization.comm
* .IServerRequest)
*/
@Override
public GetRadarDataRecordResponse handleRequest(GetRadarDataRecordRequest request)
throws Exception {
GetRadarDataRecordResponse response = new GetRadarDataRecordResponse();
DatabaseQuery query = buildQuery(request);
RadarDao dao = new RadarDao();
List<PluginDataObject> objects = (List<PluginDataObject>) dao
.queryByCriteria(query);
if (objects != null && objects.size() > 0) {
List<IDataRecord[]> hdf5Records = dao.getHDF5Data(objects, -1);
RadarRecord record;
RadarDataRecord data;
RadarDataRecord[] responseData = new RadarDataRecord[objects.size()];
for (int i = 0; i < objects.size(); i++) {
data = new RadarDataRecord();
data.setHdf5Data(hdf5Records.get(i));
record = (RadarRecord) objects.get(i);
// Strings are used to match MSAS/LAPS uEngine precision for
// side by side comparison
data.setDataTime(record.getDataTime());
data.setLatitude(record.getLatitude().toString());
data.setLongitude(record.getLongitude().toString());
data.setElevation(record.getElevation().toString());
data.setElevationNumber(record.getElevationNumber().toString());
data.setTrueElevationAngle(record.getTrueElevationAngle()
.toString());
data.setVolumeCoveragePattern(record.getVolumeCoveragePattern()
.toString());
responseData[i] = data;
}
response.setData(responseData);
}
return response;
}
/**
* Build the database query.
*
* @param request
* The request.
* @return A database query using the fields of the request.
*/
private DatabaseQuery buildQuery(GetRadarDataRecordRequest request) {
DatabaseQuery query = new DatabaseQuery(ENTITY);
query.addQueryParam("icao", request.getRadarId());
query.addQueryParam("productCode", request.getProductCode());
query.addQueryParam("primaryElevationAngle",
request.getPrimaryElevationAngle());
query.addQueryParam("dataTime.refTime", request.getTimeRange()
.getStart(), QueryOperand.GREATERTHANEQUALS);
query.addQueryParam("dataTime.refTime",
request.getTimeRange().getEnd(), QueryOperand.LESSTHANEQUALS);
return query;
}
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Radar
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.radar
Bundle-Version: 1.14.0.qualifier
Bundle-Version: 1.14.1.qualifier
Eclipse-RegisterBuddy: com.raytheon.uf.common.geospatial
Bundle-Vendor: RAYTHEON
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
@ -19,12 +19,13 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0",
org.hibernate;bundle-version="1.0.0",
com.raytheon.uf.common.numeric;bundle-version="1.14.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.dataplugin.radar.level3,
com.raytheon.uf.common.dataplugin.radar.level3.generic,
com.raytheon.uf.common.dataplugin.radar.projection,
com.raytheon.uf.common.dataplugin.radar.request,
com.raytheon.uf.common.dataplugin.radar.response,
com.raytheon.uf.common.dataplugin.radar.units,
com.raytheon.uf.common.dataplugin.radar.util

View file

@ -0,0 +1,129 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.radar.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.time.TimeRange;
/**
* A request for radar hdf5 data. Requires a radar id, product code, primary
* elevation angle, and a time range in order to search.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 7, 2014 3393 nabowle Initial creation
*
* </pre>
*
* @author nabowle
* @version 1.0
*/
@DynamicSerialize
public class GetRadarDataRecordRequest implements IServerRequest {
/** The ICAO id of the radar. */
@DynamicSerializeElement
private String radarId;
/** The product code. */
@DynamicSerializeElement
private int productCode;
/** The primary elevation angle. */
@DynamicSerializeElement
private double primaryElevationAngle;
/** The datetime range. */
@DynamicSerializeElement
private TimeRange timeRange;
/**
* Constructor.
*/
public GetRadarDataRecordRequest() {
super();
}
/**
* @return the radarId
*/
public String getRadarId() {
return radarId;
}
/**
* @param radarId
* the radarId to set
*/
public void setRadarId(String radarId) {
this.radarId = radarId;
}
/**
* @return the productCode
*/
public int getProductCode() {
return productCode;
}
/**
* @param productCode
* the productCode to set
*/
public void setProductCode(int productCode) {
this.productCode = productCode;
}
/**
* @return the primaryElevationAngle
*/
public double getPrimaryElevationAngle() {
return primaryElevationAngle;
}
/**
* @param primaryElevationAngle
* the primaryElevationAngle to set
*/
public void setPrimaryElevationAngle(double primaryElevationAngle) {
this.primaryElevationAngle = primaryElevationAngle;
}
/**
* @return the timeRange
*/
public TimeRange getTimeRange() {
return timeRange;
}
/**
* @param timeRange
* the timeRange to set
*/
public void setTimeRange(TimeRange timeRange) {
this.timeRange = timeRange;
}
}

View file

@ -0,0 +1,80 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.radar.response;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Response object to a GetRadarHDF5Request.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 7, 2014 3393 nabowle Initial creation
*
* </pre>
*
* @author nabowle
* @version 1.0
*/
@DynamicSerialize
public class GetRadarDataRecordResponse {
@DynamicSerializeElement
private RadarDataRecord[] data;
/**
* Constructor.
*/
public GetRadarDataRecordResponse() {
super();
}
/**
* Constructor.
*
* @param datas
* The response data.
*/
public GetRadarDataRecordResponse(RadarDataRecord... datas) {
super();
this.data = datas;
}
/**
* @return the data
*/
public RadarDataRecord[] getData() {
return data;
}
/**
* @param data
* the data to set
*/
public void setData(RadarDataRecord[] data) {
this.data = data;
}
}

View file

@ -0,0 +1,200 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.radar.response;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
/**
* A data object for a single radar record. The IDataRecords and a subset of the
* radar fields are available.
*
* String fields are used to match MSAS/LAPS uEngine precision for side by side
* comparison.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 7, 2014 3393 nabowle Initial creation
*
* </pre>
*
* @author nabowle
* @version 1.0
*/
@DynamicSerialize
public class RadarDataRecord {
@DynamicSerializeElement
private IDataRecord[] hdf5Data;
@DynamicSerializeElement
private DataTime dataTime;
@DynamicSerializeElement
private String latitude;
@DynamicSerializeElement
private String longitude;
@DynamicSerializeElement
private String elevation;
@DynamicSerializeElement
private String elevationNumber;
@DynamicSerializeElement
private String trueElevationAngle;
@DynamicSerializeElement
private String volumeCoveragePattern;
/**
* Constructor.
*/
public RadarDataRecord() {
super();
}
/**
* @return the hdf5Data
*/
public IDataRecord[] getHdf5Data() {
return hdf5Data;
}
/**
* @param hdf5Data
* the hdf5Data to set
*/
public void setHdf5Data(IDataRecord[] hdf5Data) {
this.hdf5Data = hdf5Data;
}
/**
* @return the dataTime
*/
public DataTime getDataTime() {
return dataTime;
}
/**
* @param dataTime
* the dataTime to set
*/
public void setDataTime(DataTime dataTime) {
this.dataTime = dataTime;
}
/**
* @return the latitude
*/
public String getLatitude() {
return latitude;
}
/**
* @param latitude
* the latitude to set
*/
public void setLatitude(String latitude) {
this.latitude = latitude;
}
/**
* @return the longitude
*/
public String getLongitude() {
return longitude;
}
/**
* @param longitude
* the longitude to set
*/
public void setLongitude(String longitude) {
this.longitude = longitude;
}
/**
* @return the elevation
*/
public String getElevation() {
return elevation;
}
/**
* @param elevation
* the elevation to set
*/
public void setElevation(String elevation) {
this.elevation = elevation;
}
/**
* @return the elevationNumber
*/
public String getElevationNumber() {
return elevationNumber;
}
/**
* @param elevationNumber
* the elevationNumber to set
*/
public void setElevationNumber(String elevationNumber) {
this.elevationNumber = elevationNumber;
}
/**
* @return the trueElevationAngle
*/
public String getTrueElevationAngle() {
return trueElevationAngle;
}
/**
* @param trueElevationAngle
* the trueElevationAngle to set
*/
public void setTrueElevationAngle(String trueElevationAngle) {
this.trueElevationAngle = trueElevationAngle;
}
/**
* @return the volumeCoveragePattern
*/
public String getVolumeCoveragePattern() {
return volumeCoveragePattern;
}
/**
* @param volumeCoveragePattern
* the volumeCoveragePattern to set
*/
public void setVolumeCoveragePattern(String volumeCoveragePattern) {
this.volumeCoveragePattern = volumeCoveragePattern;
}
}

View file

@ -25,7 +25,8 @@ __all__ = [
'grib',
'grid',
'level',
'message'
'message',
'radar'
]

View file

@ -0,0 +1,28 @@
##
# 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.
##
# File auto-generated by PythonFileGenerator
__all__ = [
'request',
'response'
]

View file

@ -0,0 +1,62 @@
##
# 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.
##
# File auto-generated against equivalent DynamicSerialize Java class
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Aug 19, 2014 nabowle Generated
import numpy
class GetRadarDataRecordRequest(object):
def __init__(self):
self.timeRange = None
self.productCode = None
self.radarId = None
self.primaryElevationAngle = None
def getTimeRange(self):
return self.timeRange
def setTimeRange(self, timeRange):
self.timeRange = timeRange
def getProductCode(self):
return self.productCode
def setProductCode(self, productCode):
self.productCode = productCode
def getRadarId(self):
return self.radarId
def setRadarId(self, radarId):
self.radarId = radarId
def getPrimaryElevationAngle(self):
return self.primaryElevationAngle
def setPrimaryElevationAngle(self, primaryElevationAngle):
self.primaryElevationAngle = numpy.float64(primaryElevationAngle)

View file

@ -0,0 +1,28 @@
##
# 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.
##
# File auto-generated by PythonFileGenerator
__all__ = [
'GetRadarDataRecordRequest'
]
from GetRadarDataRecordRequest import GetRadarDataRecordRequest

View file

@ -0,0 +1,39 @@
##
# 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.
##
# File auto-generated against equivalent DynamicSerialize Java class
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Aug 19, 2014 nabowle Generated
class GetRadarDataRecordResponse(object):
def __init__(self):
self.data = None
def getData(self):
return self.data
def setData(self, data):
self.data = data

View file

@ -0,0 +1,88 @@
##
# 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.
##
# File auto-generated against equivalent DynamicSerialize Java class
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Aug 19, 2014 nabowle Generated
class RadarDataRecord(object):
def __init__(self):
self.hdf5Data = None
self.trueElevationAngle = None
self.elevationNumber = None
self.elevation = None
self.longitude = None
self.latitude = None
self.dataTime = None
self.volumeCoveragePattern = None
def getHdf5Data(self):
return self.hdf5Data
def setHdf5Data(self, hdf5Data):
self.hdf5Data = hdf5Data
def getTrueElevationAngle(self):
return self.trueElevationAngle
def setTrueElevationAngle(self, trueElevationAngle):
self.trueElevationAngle = trueElevationAngle
def getElevationNumber(self):
return self.elevationNumber
def setElevationNumber(self, elevationNumber):
self.elevationNumber = elevationNumber
def getElevation(self):
return self.elevation
def setElevation(self, elevation):
self.elevation = elevation
def getLongitude(self):
return self.longitude
def setLongitude(self, longitude):
self.longitude = longitude
def getLatitude(self):
return self.latitude
def setLatitude(self, latitude):
self.latitude = latitude
def getDataTime(self):
return self.dataTime
def setDataTime(self, dataTime):
self.dataTime = dataTime
def getVolumeCoveragePattern(self):
return self.volumeCoveragePattern
def setVolumeCoveragePattern(self, volumeCoveragePattern):
self.volumeCoveragePattern = volumeCoveragePattern

View file

@ -0,0 +1,30 @@
##
# 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.
##
# File auto-generated by PythonFileGenerator
__all__ = [
'GetRadarDataRecordResponse',
'RadarDataRecord'
]
from GetRadarDataRecordResponse import GetRadarDataRecordResponse
from RadarDataRecord import RadarDataRecord

View file

@ -1,4 +1,24 @@
#!/bin/csh
##
# 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.
##
#
# A script wrapper that is meant to get data for a single radar product
# from the A-II database. The result is output to stdout as ASCII.
@ -22,7 +42,7 @@
#
# Usage:
#
# a2gtrad.csh {p} {x} radar msgcode {elev} date time {slop}
# a2advrad.csh {p} {x} radar msgcode {elev} date time {slop}
#
# p - A literal p. (optional)
# x - A literal x. (optional) Expanded set of header information.
@ -37,7 +57,15 @@
#
# The literal p option means preserve the final version of the python
# submitted to the UEngine instead of cleaning it up. The path to the
# finalized python is /tmp/a2gtradNNNNN.py where NNNNN is a unix process id.
# finalized python is /tmp/a2advradNNNNN.py where NNNNN is a unix process id.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/07/2014 3393 nabowle Initial modification. Passes parameters straight to
# non-uengine script instead of sed. Remove use of gtasUtil
# if not using the uengine stub.
#
#
set rmpy = yes
@ -71,37 +99,49 @@ set fxa_home = $FXA_HOME
if ( $?STAGING ) then
set fxa_home = $STAGING/D-2D
endif
#
# Set up the environment we need to run the UEngine.
#
if ( -e ./UEngine.cshsrc ) then
set ueenv = ./UEngine.cshsrc
else if ( -e $mydir/UEngine.cshsrc ) then
set ueenv = $mydir/UEngine.cshsrc
else if ( -e $fxa_home/src/dm/point/UEngine.cshsrc ) then
set ueenv = $fxa_home/src/dm/point/UEngine.cshsrc
else if ( -e $FXA_HOME/bin/UEngine.cshsrc ) then
set ueenv = $FXA_HOME/bin/UEngine.cshsrc
else
bash -c "echo could not find UEngine.cshsrc 1>&2"
exit
endif
source $ueenv
#
# Locate python stub that we will modify to create the final UEngine script
#
if ( -e ./a2gtradStub.py ) then
set stubpy = ./a2gtradStub.py
else if ( -e $mydir/a2gtradStub.py ) then
set stubpy = $mydir/a2gtradStub.py
else if ( -e $fxa_home/src/dm/radar/a2gtradStub.py ) then
set stubpy = $fxa_home/src/dm/radar/a2gtradStub.py
else if ( -e $FXA_HOME/bin/a2gtradStub.py ) then
set stubpy = $FXA_HOME/bin/a2gtradStub.py
if ( -e ./a2advradStub.py ) then
set stubpy = ./a2advradStub.py
else if ( -e $mydir/a2advradStub.py ) then
set stubpy = $mydir/a2advradStub.py
else if ( -e $fxa_home/src/dm/radar/a2advradStub.py ) then
set stubpy = $fxa_home/src/dm/radar/a2advradStub.py
else if ( -e $FXA_HOME/bin/a2advradStub.py ) then
set stubpy = $FXA_HOME/bin/a2advradStub.py
else
bash -c "echo could not find a2gtradStub.py 1>&2"
bash -c "echo could not find a2advradStub.py 1>&2"
exit
endif
#
# Determine if we are using the data access framework or the uEngine.
#
grep DataAccessLayer $stubpy >& /dev/null
if ( $status == 0 ) then
set method = "daf"
else
#
# Set up the environment we need to run the UEngine.
#
set method = "uengine"
if ( -e ./UEngine.cshsrc ) then
set ueenv = ./UEngine.cshsrc
else if ( -e $mydir/UEngine.cshsrc ) then
set ueenv = $mydir/UEngine.cshsrc
else if ( -e $FXA_HOME/src/dm/point/UEngine.cshsrc ) then
set ueenv = $FXA_HOME/src/dm/point/UEngine.cshsrc
else if ( -e $FXA_HOME/bin/UEngine.cshsrc ) then
set ueenv = $FXA_HOME/bin/UEngine.cshsrc
else
bash -c "echo could not find UEngine.cshsrc 1>&2"
exit
endif
source $ueenv
endif
#
# Locate file that lets us provide a description of the data set.
#
@ -124,49 +164,69 @@ set mmm = $2
shift
shift
set ddd = `echo $mmm | sed -f $mctrans | cut '-d|' -f2 `
#
# Get program that can do math with ascii time string, then use this to
# properly encode range of times for which we look for data.
#
if ( -x ./gtasUtil ) then
set gtasUtil = ./gtasUtil
else if ( -x $mydir/gtasUtil ) then
set gtasUtil = $mydir/gtasUtil
else if ( -x $fxa_home/src/dm/point/gtasUtil ) then
set gtasUtil = $fxa_home/src/dm/point/gtasUtil
else if ( -x $FXA_HOME/bin/gtasUtil ) then
set gtasUtil = $FXA_HOME/bin/gtasUtil
else
bash -c "echo could not find gtasUtil executable 1>&2"
exit
endif
set eee = `echo $1 | grep -v '.*-'`
if ( "$eee" != "" ) shift
set slop = `echo $3 | grep '[0-9]'`
if ( "$slop" == "" ) set slop = 60
set aaa = `$gtasUtil = $1 $2 -$slop`
set bbb = `$gtasUtil = $1 $2 $slop`
#
# Modify the text of special tags in stub to create finalized script.
#
set specpy = /tmp/a2gtrad${$}.py
rm -rf $specpy >& /dev/null
touch $specpy
chmod 775 $specpy
if ( "$eee" == "" ) then
if ( "$method" == "daf" ) then
set datetime = $1' '$2
set opts = ""
if ( "$eee" != "" ) then
set opts = "$opts --angle $eee"
endif
if ( "$fff" == "x" ) then
set opts = "$opts --extended"
endif
/awips2/python/bin/python $stubpy --radar $rrr --code $mmm --datetime="${datetime}" --slop $slop --description="${ddd}" $opts
else
#
# Get program that can do math with ascii time string, then use this to
# properly encode range of times for which we look for data.
#
if ( -x ./gtasUtil ) then
set gtasUtil = ./gtasUtil
else if ( -x $mydir/gtasUtil ) then
set gtasUtil = $mydir/gtasUtil
else if ( -x $fxa_home/src/dm/point/gtasUtil ) then
set gtasUtil = $fxa_home/src/dm/point/gtasUtil
else if ( -x $FXA_HOME/bin/gtasUtil ) then
set gtasUtil = $FXA_HOME/bin/gtasUtil
else
bash -c "echo could not find gtasUtil executable 1>&2"
exit
endif
set aaa = `$gtasUtil = $1 $2 -$slop`
set bbb = `$gtasUtil = $1 $2 $slop`
#
# Modify the text of special tags in stub to create finalized script.
#
set specpy = /tmp/a2advrad${$}.py
rm -rf $specpy >& /dev/null
touch $specpy
chmod 775 $specpy
if ( "$eee" == "" ) then
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$mmm/g" | \
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | sed "s/FFF/$fff/g" | \
sed "s/DDDDD/$ddd/g" | sed 's/^.*EEEE.*$//g' >> $specpy
else
else
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$mmm/g" | \
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | sed "s/FFF/$fff/g" | \
sed "s/DDDDD/$ddd/g" | sed "s/EEEE/$eee/g" >> $specpy
endif
#
# Submit the temporary python script stripping xml stuff, then remove it
#
cd $UE_BIN_PATH
( uengine -r python < $specpy ) | grep -v '<' | sed 's/&gt;/>/g' | \
sed 's/&lt;/</g' | grep -v Response
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
endif
#
# Submit the temporary python script stripping xml stuff, then remove it
#
cd $UE_BIN_PATH
( uengine -r python < $specpy ) | grep -v '<' | sed 's/&gt;/>/g' | \
sed 's/&lt;/</g' | grep -v Response
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
#

View file

@ -1,83 +1,82 @@
import BaseRequest
from com.raytheon.uf.common.message.response import ResponseMessageGeneric
from com.raytheon.edex.plugin.radar.dao import RadarDao
# Perform a radar request for data of interest
rr = BaseRequest.BaseRequest("radar")
rr.addParameter("icao","KKKK","=")
rr.addParameter("productCode","MMMM","=")
rr.addParameter("primaryElevationAngle","EEEE","=")
rr.addParameter("dataTime","AAAAA",">=")
rr.addParameter("dataTime","BBBBB","<=")
hedfmt = "FFF"
result = rr.execute()
size = result.size()
if size == 0:
return ResponseMessageGeneric("Data not available")
# ResponseMessageGeneric. Payload is RadarRecord
rmg = result.get(0)
# return rmg
# RadarRecord
rrec = rmg.getContents()
##
# 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.
##
#
# From here to the end is the part we know how to do for radar but not
# for radar.
# Gets data for a single radar product from the A-II database. The result is
# output to stdout as ASCII. This uses a data-specific Request/Response instead
# of the DataAccessLayer in order to preserve data-genericness of the interface.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/13/2014 3393 nabowle Initial modification. Replaces UEngine
# with a custom Request/Response.
#
#
mytime = rrec.getDataURI().split('/',4)[2]
# RadarDao. Inherits from PluginDao, which has a getHDF5Data method,
# which takes a PluginDataObject as an arg.
raddao = RadarDao("radar")
import argparse
import a2radcommon
# returns IDataRecord[]. IDataRecord is implemented by only one class --
# AbstractStorageRecord. ASR is extended by a few *DataRecord classes; one
# of them is ByteDataRecord
idra = raddao.getHDF5Data(rrec,-1)
def get_args():
parser = a2radcommon.get_args_parser()
parser.add_argument("--extended", action='store_true', default=False,
dest="extended", help="Output the extended header.")
return parser.parse_args()
msg = "No data."
if len(idra) > 0:
# pick radar Data record
# record 0 contains Angles getFloatData
# record 1 contains Data getByteData
# record 2 contains DependentValues getShortData
# record 3 contains ProductVals getByteData
# record 4 contains RecordVals getByteData
# record 5 contains StormIds getByteData
# record 6 contains Symbology getByteData
# record 7 contains SymbologyData getByteData
# record 8 contains Thresholds getShortData
dattyp = "raster"
for ii in range(len(idra)):
if idra[ii].getName() == "Data":
rdat = idra[ii]
elif idra[ii].getName() == "Angles":
azdat = idra[ii]
dattyp = "radial"
elif idra[ii].getName() == "DependentValues":
depVals = idra[ii].getShortData()
# elif idra[ii].getName() == "ProductVals":
# prodVals = idra[ii].getByteData()
# elif idra[ii].getName() == "RecordVals":
# recVals = idra[ii].getByteData()
# elif idra[ii].getName() == "StormIds":
# stormVals = idra[ii].getByteData()
# elif idra[ii].getName() == "Symbology":
# symVals = idra[ii].getByteData()
# elif idra[ii].getName() == "SymbologyData":
# symData = idra[ii].getByteData()
elif idra[ii].getName() == "Thresholds":
threshVals = idra[ii].getShortData()
# this hints at the IDR's concrete class: ByteDataRecord
#print "true type of IDataRecord:", idr.getDataObject().toString()
def main():
user_args = get_args()
records = a2radcommon.send_request(user_args)
if not records:
# print "Data not available"
return
description = user_args.description
if not description:
print >> sys.stderr, "Description not provided"
return
format = user_args.extended
print_record(records[0], format, description)
def print_record(record, format, description):
idra = record.getHdf5Data()
rdat,azdat,depVals,threshVals = a2radcommon.get_hdf5_data(idra)
if not rdat:
# Graphic, XY
# print "Unsupported radar format"
return
dim = rdat.getDimension()
if dim != 2:
return ResponseMessageGeneric(msg)
# print "Data not available"
return
yLen = rdat.getSizes()[0]
xLen = rdat.getSizes()[1]
@ -86,82 +85,32 @@ if len(idra) > 0:
array = rdat.getByteData()
arraySize = len(array)
if xLen * yLen != arraySize:
return ResponseMessageGeneric(msg)
# print "Data not available"
return
# get data for azimuth angles if we have them.
if dattyp == "radial" :
if azdat :
azVals = azdat.getFloatData()
azValsLen = len(azVals)
if yLen != azValsLen:
return ResponseMessageGeneric(msg)
description = "DDDDD"
# print "Data not available"
return
# Encode dimensions, time, mapping, description, tilt, and VCP
if hedfmt == "x" :
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + str(rrec.getLatitude()) + " " + \
str(rrec.getLongitude()) + " " + \
str(rrec.getElevation()) + " " + \
str(rrec.getElevationNumber()) + " " + \
description + " " + str(rrec.getTrueElevationAngle()) + " " + \
str(rrec.getVolumeCoveragePattern()) + "\n"
else :
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + description + " " + \
str(rrec.getTrueElevationAngle()) + " " + \
str(rrec.getVolumeCoveragePattern()) + "\n"
msg = a2radcommon.get_header(record, format, xLen, yLen, azdat, description)
# Encode level labels
spec = [".", "TH", "ND", "RF", "BI", "GC", "IC", "GR", "WS", "DS",
"RA", "HR", "BD", "HA", "UK"]
nnn = len(threshVals)
j = 0
while j<nnn :
lo = threshVals[j] % 256
hi = threshVals[j] / 256
msg += " "
j += 1
if hi < 0 :
if lo > 14 :
msg += "."
else :
msg += spec[lo]
continue
if hi % 16 >= 8 :
msg += ">"
elif hi % 8 >= 4 :
msg += "<"
if hi % 4 >= 2 :
msg += "+"
elif hi % 2 >= 1 :
msg += "-"
if hi >= 64 :
msg += "%.2f"%(lo*0.01)
elif hi % 64 >= 32 :
msg += "%.2f"%(lo*0.05)
elif hi % 32 >= 16 :
msg += "%.1f"%(lo*0.1)
else :
msg += str(lo)
msg += "\n"
msg += a2radcommon.encode_thresh_vals(threshVals)
msg += a2radcommon.encode_dep_vals(depVals)
if azdat :
msg += a2radcommon.encode_radial(azVals)
msg += encode_data(yLen, xLen, array)
# Encode product dependent parameters 17 through 26
nnn = len(depVals)
j = 0
while j<nnn :
msg += " " + str(depVals[j])
j += 1
msg += "\n"
print msg
if dattyp == "radial" :
j = 0
while j<azValsLen :
msg += "%.1f"%azVals[j] + " "
j += 1
msg += "\n"
def encode_data(yLen, xLen, array):
nxy = yLen*xLen
j = 0
msg = ""
while j<nxy :
i = 0
while i<xLen :
@ -172,6 +121,8 @@ if len(idra) > 0:
i += 1
msg += "\n"
j += xLen
return msg[0:-1]
return ResponseMessageGeneric(msg)
if __name__ == '__main__':
main()

View file

@ -1,4 +1,24 @@
#!/bin/csh
##
# 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.
##
#
# A script wrapper that is meant to get data for a single radar product
# from the A-II database. The result is output to stdout as ASCII.
@ -51,7 +71,17 @@
# submitted to the UEngine instead of cleaning it up. The path to the
# finalized python is /tmp/a2gtradNNNNN.py where NNNNN is a unix process id.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/07/2014 3393 nabowle Initial modification. Passes parameters straight to
# non-uengine script instead of sed. Remove use of gtasUtil
# if not using the uengine stub.
#
#
#
set rmpy = yes
set fff = ""
set encoding = 2
@ -151,55 +181,77 @@ set mmm = $2
shift
shift
set ddd = `echo $mmm | sed -f $mctrans | cut '-d|' -f2 `
#
# Get program that can do math with ascii time string, then use this to
# properly encode range of times for which we look for data.
#
if ( -x ./gtasUtil ) then
set gtasUtil = ./gtasUtil
else if ( -x $mydir/gtasUtil ) then
set gtasUtil = $mydir/gtasUtil
else if ( -x $fxa_home/src/dm/point/gtasUtil ) then
set gtasUtil = $fxa_home/src/dm/point/gtasUtil
else if ( -x $FXA_HOME/bin/gtasUtil ) then
set gtasUtil = $FXA_HOME/bin/gtasUtil
else
bash -c "echo could not find gtasUtil executable 1>&2"
exit
endif
set eee = `echo $1 | grep -v '.*-'`
if ( "$eee" != "" ) shift
set slop = `echo $3 | grep '[0-9]'`
if ( "$slop" == "" ) set slop = 60
set aaa = `$gtasUtil = $1 $2 -$slop`
set bbb = `$gtasUtil = $1 $2 $slop`
#
# Modify the text of special tags in stub to create finalized script.
#
set specpy = /tmp/a2gtrad${$}.py
rm -rf $specpy >& /dev/null
touch $specpy
chmod 775 $specpy
if ( "$eee" == "" ) then
if ( "$method" == "daf" ) then
set datetime = $1' '$2
set opts = ""
if ( "$eee" != "" ) then
set opts = "$opts --angle $eee"
endif
if ( "$fff" == "x" ) then
set opts = "$opts --extended"
endif
if ( "$encoding" == "1" ) then
set opts = "$opts --hex"
else if ( "$encoding" == "0" ) then
set opts = "$opts --int"
endif
/awips2/python/bin/python $stubpy --radar $rrr --code $mmm --datetime="${datetime}" --slop $slop --description="${ddd}" $opts
else
#
# Get program that can do math with ascii time string, then use this to
# properly encode range of times for which we look for data.
#
if ( -x ./gtasUtil ) then
set gtasUtil = ./gtasUtil
else if ( -x $mydir/gtasUtil ) then
set gtasUtil = $mydir/gtasUtil
else if ( -x $fxa_home/src/dm/point/gtasUtil ) then
set gtasUtil = $fxa_home/src/dm/point/gtasUtil
else if ( -x $FXA_HOME/bin/gtasUtil ) then
set gtasUtil = $FXA_HOME/bin/gtasUtil
else
bash -c "echo could not find gtasUtil executable 1>&2"
exit
endif
set aaa = `$gtasUtil = $1 $2 -$slop`
set bbb = `$gtasUtil = $1 $2 $slop`
#
# Modify the text of special tags in stub to create finalized script.
#
set specpy = /tmp/a2gtrad${$}.py
rm -rf $specpy >& /dev/null
touch $specpy
chmod 775 $specpy
if ( "$eee" == "" ) then
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$mmm/g" | \
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | sed "s/FFF/$fff/g" | \
sed "s/DDDDD/$ddd/g" | sed 's/^.*EEEE.*$//g' | \
sed "s/XXXXX/$encoding/g" >> $specpy
else
else
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$mmm/g" | \
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | sed "s/FFF/$fff/g" | \
sed "s/DDDDD/$ddd/g" | sed "s/EEEE/$eee/g" | \
sed "s/XXXXX/$encoding/g" >> $specpy
endif
#
# Submit the temporary python script stripping xml stuff, then remove it
#
if ( "$method" == "daf" ) then
/awips2/python/bin/python $specpy
else
endif
#
# Submit the temporary python script stripping xml stuff, then remove it
#
cd $UE_BIN_PATH
( uengine -r python < $specpy ) | grep -v '<' | sed 's/&gt;/>/g' | \
sed 's/&lt;/</g' | grep -v Response
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
endif
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
#

View file

@ -1,84 +1,89 @@
import BaseRequest
from com.raytheon.uf.common.message.response import ResponseMessageGeneric
from com.raytheon.edex.plugin.radar.dao import RadarDao
# Perform a radar request for data of interest
rr = BaseRequest.BaseRequest("radar")
rr.addParameter("icao","KKKK","=")
rr.addParameter("productCode","MMMM","=")
rr.addParameter("primaryElevationAngle","EEEE","=")
rr.addParameter("dataTime","AAAAA",">=")
rr.addParameter("dataTime","BBBBB","<=")
hedfmt = "FFF"
encoding = XXXXX
result = rr.execute()
size = result.size()
if size == 0:
return ResponseMessageGeneric("Data not available")
# ResponseMessageGeneric. Payload is RadarRecord
rmg = result.get(0)
# return rmg
# RadarRecord
rrec = rmg.getContents()
##
# 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.
##
#
# From here to the end is the part we know how to do for radar but not
# for radar.
# Gets data for a single radar product from the A-II database. The result is
# output to stdout as ASCII. This uses a data-specific Request/Response instead
# of the DataAccessLayer in order to preserve data-genericness of the interface.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/11/2014 3393 nabowle Initial modification. Replaces UEngine
# with a custom Request/Response.
#
#
mytime = rrec.getDataURI().split('/',4)[2]
# RadarDao. Inherits from PluginDao, which has a getHDF5Data method,
# which takes a PluginDataObject as an arg.
raddao = RadarDao("radar")
import argparse
import a2radcommon
# returns IDataRecord[]. IDataRecord is implemented by only one class --
# AbstractStorageRecord. ASR is extended by a few *DataRecord classes; one
# of them is ByteDataRecord
idra = raddao.getHDF5Data(rrec,-1)
def get_args():
parser = a2radcommon.get_args_parser()
parser.add_argument("--hex", action='store_const', dest="encoding",
const=1, help="Hex encoding.", metavar="encoding")
parser.add_argument("--int", action='store_const', dest="encoding",
const=0, help="Delimited integer encoding.",
metavar="encoding")
parser.add_argument("--extended", action='store_true', default=False,
dest="extended", help="Output the extended header.")
return parser.parse_args()
msg = "No data."
if len(idra) > 0:
# pick radar Data record
# record 0 contains Angles getFloatData
# record 1 contains Data getByteData
# record 2 contains DependentValues getShortData
# record 3 contains ProductVals getByteData
# record 4 contains RecordVals getByteData
# record 5 contains StormIds getByteData
# record 6 contains Symbology getByteData
# record 7 contains SymbologyData getByteData
# record 8 contains Thresholds getShortData
dattyp = "raster"
for ii in range(len(idra)):
if idra[ii].getName() == "Data":
rdat = idra[ii]
elif idra[ii].getName() == "Angles":
azdat = idra[ii]
dattyp = "radial"
elif idra[ii].getName() == "DependentValues":
depVals = idra[ii].getShortData()
# elif idra[ii].getName() == "ProductVals":
# prodVals = idra[ii].getByteData()
# elif idra[ii].getName() == "RecordVals":
# recVals = idra[ii].getByteData()
# elif idra[ii].getName() == "StormIds":
# stormVals = idra[ii].getByteData()
# elif idra[ii].getName() == "Symbology":
# symVals = idra[ii].getByteData()
# elif idra[ii].getName() == "SymbologyData":
# symData = idra[ii].getByteData()
elif idra[ii].getName() == "Thresholds":
threshVals = idra[ii].getShortData()
# this hints at the IDR's concrete class: ByteDataRecord
#print "true type of IDataRecord:", idr.getDataObject().toString()
def main():
user_args = get_args()
records = a2radcommon.send_request(user_args)
if not records:
# print "Data not available"
return
description = user_args.description
if not description:
print >> sys.stderr, "Description not provided"
return
format = user_args.extended
encoding = user_args.encoding
print_record(records[0], format, description, encoding)
def print_record(record, format, description, encoding):
idra = record.getHdf5Data()
rdat,azdat,depVals,threshVals = a2radcommon.get_hdf5_data(idra)
if not rdat:
# Graphic, XY
# print "Unsupported radar format"
return
dim = rdat.getDimension()
if dim != 2:
return ResponseMessageGeneric(msg)
# print "Data not available"
return
yLen = rdat.getSizes()[0]
xLen = rdat.getSizes()[1]
@ -87,84 +92,34 @@ if len(idra) > 0:
array = rdat.getByteData()
arraySize = len(array)
if xLen * yLen != arraySize:
return ResponseMessageGeneric(msg)
# print "Data not available"
return
# get data for azimuth angles if we have them.
if dattyp == "radial" :
if azdat :
azVals = azdat.getFloatData()
azValsLen = len(azVals)
if yLen != azValsLen:
return ResponseMessageGeneric(msg)
description = "DDDDD"
# print "Data not available"
return
# Encode dimensions, time, mapping, description, tilt, and VCP
if hedfmt == "x" :
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + str(rrec.getLatitude()) + " " + \
str(rrec.getLongitude()) + " " + \
str(rrec.getElevation()) + " " + \
str(rrec.getElevationNumber()) + " " + \
description + " " + str(rrec.getTrueElevationAngle()) + " " + \
str(rrec.getVolumeCoveragePattern()) + "\n"
else :
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + description + " " + \
str(rrec.getTrueElevationAngle()) + " " + \
str(rrec.getVolumeCoveragePattern()) + "\n"
msg = a2radcommon.get_header(record, format, xLen, yLen, azdat, description)
# Encode level labels
spec = [".", "TH", "ND", "RF", "BI", "GC", "IC", "GR", "WS", "DS",
"RA", "HR", "BD", "HA", "UK"]
nnn = len(threshVals)
j = 0
while j<nnn :
lo = threshVals[j] % 256
hi = threshVals[j] / 256
msg += " "
j += 1
if hi < 0 :
if lo > 14 :
msg += "."
else :
msg += spec[lo]
continue
if hi % 16 >= 8 :
msg += ">"
elif hi % 8 >= 4 :
msg += "<"
if hi % 4 >= 2 :
msg += "+"
elif hi % 2 >= 1 :
msg += "-"
if hi >= 64 :
msg += "%.2f"%(lo*0.01)
elif hi % 64 >= 32 :
msg += "%.2f"%(lo*0.05)
elif hi % 32 >= 16 :
msg += "%.1f"%(lo*0.1)
else :
msg += str(lo)
msg += "\n"
msg += a2radcommon.encode_thresh_vals(threshVals)
msg += a2radcommon.encode_dep_vals(depVals)
if azdat :
msg += a2radcommon.encode_radial(azVals)
msg += encode_data(yLen, xLen, array, encoding)
# Encode product dependent parameters 17 through 26
nnn = len(depVals)
j = 0
while j<nnn :
msg += " " + str(depVals[j])
j += 1
msg += "\n"
print msg.strip()
if dattyp == "radial" :
j = 0
while j<azValsLen :
msg += "%.1f"%azVals[j] + " "
j += 1
msg += "\n"
def encode_data(yLen, xLen, array, encoding):
plus = " ghijklmnopqrstuvwxyz"
minus = " GHIJKLMNOPQRSTUVWXYZ"
nxy = yLen*xLen
j = 0
msg = ""
while j<nxy :
i = 0
kk = array[i+j]
@ -203,6 +158,9 @@ if len(idra) > 0:
i += 1
msg += "\n"
j += xLen
return msg
return ResponseMessageGeneric(msg)
if __name__ == '__main__':
main()

View file

@ -1,57 +1,126 @@
import BaseRequest
import RadarRequest
from com.raytheon.uf.common.message.response import ResponseMessageGeneric
from com.raytheon.edex.plugin.radar.dao import RadarDao
import numpy
# Perform a radar request for data of interest
rr = BaseRequest.BaseRequest("radar")
rr.addParameter("icao","KKKK","=")
rr.addParameter("productCode","MMMM","=")
rr.addParameter("primaryElevationAngle","EEEE","=")
rr.addParameter("dataTime","AAAAA",">=")
rr.addParameter("dataTime","BBBBB","<=")
result = rr.execute()
size = result.size()
if size == 0:
return ResponseMessageGeneric("Data not available")
# ResponseMessageGeneric. Payload is RadarRecord
rmg = result.get(0)
# return rmg
# RadarRecord
rrec = rmg.getContents()
##
# 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.
##
#
# From here to the end is the part we know how to do for radar but not
# for radar.
# Gets data for a single radar product from the A-II database. The result is
# output to stdout as ASCII. This uses a data-specific Request/Response instead
# of the DataAccessLayer in order to preserve data-genericness of the interface.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/11/2014 3393 nabowle Initial modification. Replaces UEngine
# with a custom Request/Response.
#
#
mytime = rrec.getDataURI().split('/',4)[2]
# RadarDao. Inherits from PluginDao, which has a getHDF5Data method,
# which takes a PluginDataObject as an arg.
raddao = RadarDao("radar")
import argparse
import a2radcommon
# returns IDataRecord[]. IDataRecord is implemented by only one class --
# AbstractStorageRecord. ASR is extended by a few *DataRecord classes; one
# of them is ByteDataRecord
idra = raddao.getHDF5Data(rrec,-1)
def get_args():
parser = a2radcommon.get_args_parser()
return parser.parse_args()
msg = "No data."
if len(idra) > 0:
# pick radar Data record
# record 0 contains Angles getFloatData
# record 1 contains Data getByteData
# record 2 contains DependentValues getShortData
# record 3 contains ProductVals getByteData
# record 4 contains RecordVals getByteData
# record 5 contains StormIds getByteData
# record 6 contains Symbology getByteData
# record 7 contains SymbologyData getByteData
# record 8 contains Thresholds getShortData
dattyp = "raster"
def main():
user_args = get_args()
records = a2radcommon.send_request(user_args)
if not records:
# print "Data not available"
return
description = user_args.description
if not description:
print >> sys.stderr, "Description not provided"
return
print_record(records[0], description)
def print_record(record, description):
idra = record.getHdf5Data()
rdat,azdat,depVals,prodVals,recVals,stormVals,symVals,symData,threshVals = get_hdf5_data(idra)
if not rdat:
# Graphic, XY
# print "Unsupported radar format"
return
dim = rdat.getDimension()
if dim != 2:
# print "Data not available"
return
yLen = rdat.getSizes()[0]
xLen = rdat.getSizes()[1]
# byte[] -- the raw data
array = rdat.getByteData()
arraySize = len(array)
if xLen * yLen != arraySize:
# print "Data not available"
return
# get data for azimuth angles if we have them.
if azdat :
azVals = azdat.getFloatData()
azValsLen = len(azVals)
if yLen != azValsLen:
# print "Data not available"
return
msg = get_header(record, xLen, yLen, azdat, description)
msg += encode_dep_vals(depVals)
msg += encode_prod_vals(prodVals)
msg += encode_rec_vals(recVals)
msg += encode_storm_vals(stormVals)
msg += encode_sym_vals(symVals)
msg += encode_sym_data(symData)
msg += encode_thresh_vals(threshVals)
if azdat :
msg += a2radcommon.encode_radial(azVals)
msg += encode_data(yLen, xLen, array)
print msg
def get_hdf5_data(idra):
rdat = []
azdat = []
depVals = []
prodVals = []
recVals = []
stormVals = []
symVals = []
symData = []
threshVals = []
if len(idra) > 0:
for ii in range(len(idra)):
if idra[ii].getName() == "Data":
rdat = idra[ii]
@ -73,37 +142,24 @@ if len(idra) > 0:
elif idra[ii].getName() == "Thresholds":
threshVals = idra[ii].getShortData()
# this hints at the IDR's concrete class: ByteDataRecord
#print "true type of IDataRecord:", idr.getDataObject().toString()
return rdat,azdat,depVals,prodVals,recVals,stormVals,symVals,symData,threshVals
dim = rdat.getDimension()
if dim != 2:
return ResponseMessageGeneric(msg)
yLen = rdat.getSizes()[0]
xLen = rdat.getSizes()[1]
def get_header(record, xLen, yLen, azdat, description):
# Encode dimensions, time, mapping, description, tilt, and VCP
mytime = a2radcommon.get_datetime_str(record)
dattyp = a2radcommon.get_data_type(azdat)
# byte[] -- the raw data
array = rdat.getByteData()
arraySize = len(array)
if xLen * yLen != arraySize:
return ResponseMessageGeneric(msg)
msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + dattyp + \
" " + description + "\n" + \
str(record.getTrueElevationAngle()) + " " + \
str(record.getVolumeCoveragePattern()) + "\n"
return msg
# get data for azimuth angles if we have them.
if dattyp == "radial" :
azVals = azdat.getFloatData()
azValsLen = len(azVals)
if yLen != azValsLen:
return ResponseMessageGeneric(msg)
description = "DDDDD"
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + dattyp + \
" " + description + "\n"
msg += str(rrec.getTrueElevationAngle()) + " " + \
str(rrec.getVolumeCoveragePattern()) + "\n"
def encode_dep_vals(depVals):
nnn = len(depVals)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if depVals[j]<0 :
@ -112,9 +168,12 @@ if len(idra) > 0:
msg += " " + "%4.4X"%depVals[j]
j += 1
msg += "\n"
return msg
def encode_prod_vals(prodVals):
nnn = len(prodVals)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if prodVals[j]<0 :
@ -123,9 +182,12 @@ if len(idra) > 0:
msg += " " + "%2.2X"%prodVals[j]
j += 1
msg += "\n"
return msg
def encode_rec_vals(recVals):
nnn = len(recVals)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if recVals[j]<0 :
@ -134,9 +196,12 @@ if len(idra) > 0:
msg += " " + "%2.2X"%recVals[j]
j += 1
msg += "\n"
return msg
def encode_storm_vals(stormVals):
nnn = len(stormVals)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if stormVals[j]<0 :
@ -145,9 +210,12 @@ if len(idra) > 0:
msg += " " + "%2.2X"%stormVals[j]
j += 1
msg += "\n"
return msg
def encode_sym_vals(symVals):
nnn = len(symVals)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if symVals[j]<0 :
@ -156,9 +224,12 @@ if len(idra) > 0:
msg += " " + "%2.2X"%symVals[j]
j += 1
msg += "\n"
return msg
def encode_sym_data(symData):
nnn = len(symData)
msg += str(nnn)
msg = str(nnn)
j = 0
while j<nnn :
if symData[j]<0 :
@ -167,48 +238,16 @@ if len(idra) > 0:
msg += " " + "%2.2X"%symData[j]
j += 1
msg += "\n"
return msg
spec = [".", "TH", "ND", "RF", "BI", "GC", "IC", "GR", "WS", "DS",
"RA", "HR", "BD", "HA", "UK"]
nnn = len(threshVals)
msg += str(nnn)
j = 0
while j<nnn :
lo = threshVals[j] % 256
hi = threshVals[j] / 256
msg += " "
j += 1
if hi < 0 :
if lo > 14 :
msg += "."
else :
msg += spec[lo]
continue
if hi % 16 >= 8 :
msg += ">"
elif hi % 8 >= 4 :
msg += "<"
if hi % 4 >= 2 :
msg += "+"
elif hi % 2 >= 1 :
msg += "-"
if hi >= 64 :
msg += "%.2f"%(lo*0.01)
elif hi % 64 >= 32 :
msg += "%.2f"%(lo*0.05)
elif hi % 32 >= 16 :
msg += "%.1f"%(lo*0.1)
else :
msg += str(lo)
msg += "\n"
if dattyp == "radial" :
j = 0
while j<azValsLen :
msg += "%.1f"%azVals[j] + " "
j += 1
msg += "\n"
def encode_thresh_vals(threshVals):
msg = str(len(threshVals)) + a2radcommon.encode_thresh_vals(threshVals)
return msg
def encode_data(yLen, xLen, array):
msg = ""
nxy = yLen*xLen
j = 0
while j<nxy :
@ -221,6 +260,8 @@ if len(idra) > 0:
i += 1
msg += "\n"
j += xLen
return msg[0:-1]
return ResponseMessageGeneric(msg)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,251 @@
##
# 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.
##
#
# Common methods for the a2gtrad and a2advrad scripts.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 08/13/2014 3393 nabowle Initial creation to contain common
# code for a2*radStub scripts.
#
#
import argparse
import sys
from datetime import datetime
from datetime import timedelta
from ufpy import ThriftClient
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.radar.request import GetRadarDataRecordRequest
def get_default_host():
from ufpy.dataaccess import DataAccessLayer
return DataAccessLayer.THRIFT_HOST
def get_args_parser():
parser = argparse.ArgumentParser(conflict_handler="resolve")
parser.add_argument("--host", action="store", dest="host",
help="EDEX server hostname",
metavar="hostname")
parser.add_argument("--datetime", action="store", dest="datetime",
help="The start of the time range in YYYY-MM-DD HH:MM",
metavar="datetime")
parser.add_argument("--radar", action="store", dest="radar",
help="The ICAO code for the radar",
metavar="radar")
parser.add_argument("--code", action="store", dest="code",
help="The product code.", type=int,
metavar="code")
parser.add_argument("--angle", action="store", dest="angle", default=0,
help="The Elevation Angle", metavar="angle")
parser.add_argument("--description", action="store", dest="description",
help="The description.",
metavar="desc")
parser.add_argument("--slop", action="store", dest="slop", default=60,
help="The amount of slop, in seconds, to allow around the datetime.",
metavar="slop", type=int)
return parser
def send_request(user_args):
slop = user_args.slop
dateTimeStr = user_args.datetime
if not dateTimeStr:
print >> sys.stderr, "DateTime not provided"
return
dateTime = datetime.strptime(dateTimeStr, "%Y-%m-%d %H:%M")
beginRange = dateTime - timedelta(0, slop)
endRange = dateTime + timedelta(0, slop)
timerange = TimeRange(beginRange, endRange)
radar = user_args.radar
if not radar:
print >> sys.stderr, "Radar code not provided"
return
code = user_args.code
if not code:
print >> sys.stderr, "Product code not provided"
return
angle = user_args.angle
slop = int(user_args.slop)
host = user_args.host
if not host:
host = get_default_host()
client = ThriftClient.ThriftClient(host)
# Perform a GetRadarHDF5Request
req = GetRadarDataRecordRequest()
req.setRadarId(radar)
req.setPrimaryElevationAngle(float(angle))
req.setTimeRange(timerange)
req.setProductCode(int(code))
response = client.sendRequest(req)
if response is None:
# print "Data not available"
return
records = response.getData()
return records
def get_datetime_str(record):
#2014-07-16 00:00:00 (0) => 2014-07-16_00:03:00.0
return str(record.getDataTime())[0:19].replace(" ","_") + ".0"
def get_data_type(azdat):
if azdat:
dattyp = "radial"
else :
dattyp = "raster"
return dattyp
def get_hdf5_data(idra):
rdat = []
azdat = []
depVals = []
threshVals = []
if len(idra) > 0:
for ii in range(len(idra)):
if idra[ii].getName() == "Data":
rdat = idra[ii]
elif idra[ii].getName() == "Angles":
azdat = idra[ii]
dattyp = "radial"
elif idra[ii].getName() == "DependentValues":
depVals = idra[ii].getShortData()
## Commented out from the original. May not be available.
# elif idra[ii].getName() == "ProductVals":
# prodVals = idra[ii].getByteData()
# elif idra[ii].getName() == "RecordVals":
# recVals = idra[ii].getByteData()
# elif idra[ii].getName() == "StormIds":
# stormVals = idra[ii].getByteData()
# elif idra[ii].getName() == "Symbology":
# symVals = idra[ii].getByteData()
# elif idra[ii].getName() == "SymbologyData":
# symData = idra[ii].getByteData()
##
elif idra[ii].getName() == "Thresholds":
threshVals = idra[ii].getShortData()
return rdat,azdat,depVals,threshVals
def get_header(record, format, xLen, yLen, azdat, description):
# Encode dimensions, time, mapping, description, tilt, and VCP
mytime = get_datetime_str(record)
dattyp = get_data_type(azdat)
if format :
msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + str(record.getLatitude()) + " " + \
str(record.getLongitude()) + " " + \
str(record.getElevation()) + " " + \
str(record.getElevationNumber()) + " " + \
description + " " + str(record.getTrueElevationAngle()) + " " + \
str(record.getVolumeCoveragePattern()) + "\n"
#"%.1f"%
else :
msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + \
dattyp + " " + description + " " + \
str(record.getTrueElevationAngle()) + " " + \
str(record.getVolumeCoveragePattern()) + "\n"
return msg
def encode_thresh_vals(threshVals):
spec = [".", "TH", "ND", "RF", "BI", "GC", "IC", "GR", "WS", "DS",
"RA", "HR", "BD", "HA", "UK"]
nnn = len(threshVals)
j = 0
msg = ""
while j<nnn :
lo = threshVals[j] % 256
hi = threshVals[j] / 256
msg += " "
j += 1
if hi < 0 :
if lo > 14 :
msg += "."
else :
msg += spec[lo]
continue
if hi % 16 >= 8 :
msg += ">"
elif hi % 8 >= 4 :
msg += "<"
if hi % 4 >= 2 :
msg += "+"
elif hi % 2 >= 1 :
msg += "-"
if hi >= 64 :
msg += "%.2f"%(lo*0.01)
elif hi % 64 >= 32 :
msg += "%.2f"%(lo*0.05)
elif hi % 32 >= 16 :
msg += "%.1f"%(lo*0.1)
else :
msg += str(lo)
msg += "\n"
return msg
def encode_dep_vals(depVals):
nnn = len(depVals)
j = 0
msg = ""
while j<nnn :
msg += " " + str(depVals[j])
j += 1
msg += "\n"
return msg
def encode_radial(azVals):
azValsLen = len(azVals)
j = 0
msg = ""
while j<azValsLen :
msg += "%.1f"%azVals[j] + " "
j += 1
msg += "\n"
return msg