Omaha #3393 Add request/response for RadarDataRecord. Remove broken RadarDao override. Convert a2_rad scripts.
Change-Id: Ie3ea761920c1ecec233e1fc586f3cbcd5914f1c6 Former-commit-id:10f163ec37
[formerlyf70776903c
] [formerly2fcc25bb9b
] [formerly10f163ec37
[formerlyf70776903c
] [formerly2fcc25bb9b
] [formerly8fdc47855e
[formerly2fcc25bb9b
[formerly 44ca6fb8a26cc9af7267ce635a200eb3c26ce9f8]]]] Former-commit-id:8fdc47855e
Former-commit-id:7a50028eff
[formerlyb1fbb4e678
] [formerly 774f44cab9d2b4fee8d681e9226c84c8f3a3bc47 [formerlyf2be9c044e
]] Former-commit-id: 68fbb736180cfea0a6a71068cb181a3ebac73827 [formerlyd398fdca21
] Former-commit-id:d68602eadd
This commit is contained in:
parent
80bb517683
commit
d0df1e49ce
20 changed files with 1766 additions and 657 deletions
|
@ -14,6 +14,12 @@
|
|||
<constructor-arg value="com.raytheon.uf.common.dataplugin.radar.request.GetRadarDataTreeRequest"/>
|
||||
<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">
|
||||
|
|
|
@ -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
|
||||
* 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.
|
||||
**/
|
||||
|
@ -22,7 +22,7 @@ package com.raytheon.edex.plugin.radar.dao;
|
|||
|
||||
/**
|
||||
* Data Access Object implementation for accessing radar data
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
|
@ -30,14 +30,15 @@ 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>
|
||||
*
|
||||
*
|
||||
* @author bphillip
|
||||
* @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,17 +59,24 @@ 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
|
||||
*
|
||||
*
|
||||
* @param pluginName
|
||||
* "radar"
|
||||
* @throws PluginException
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -25,7 +25,8 @@ __all__ = [
|
|||
'grib',
|
||||
'grid',
|
||||
'level',
|
||||
'message'
|
||||
'message',
|
||||
'radar'
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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'
|
||||
]
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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,8 +57,16 @@
|
|||
#
|
||||
# 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
|
||||
set fff = ""
|
||||
|
@ -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
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
#
|
||||
# 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
|
||||
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/>/>/g' | \
|
||||
sed 's/</</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/>/>/g' | \
|
||||
sed 's/</</g' | grep -v Response
|
||||
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
|
||||
#
|
||||
|
|
|
@ -1,177 +1,128 @@
|
|||
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()
|
||||
|
||||
dim = rdat.getDimension()
|
||||
if dim != 2:
|
||||
return ResponseMessageGeneric(msg)
|
||||
records = a2radcommon.send_request(user_args)
|
||||
|
||||
yLen = rdat.getSizes()[0]
|
||||
xLen = rdat.getSizes()[1]
|
||||
if not records:
|
||||
# print "Data not available"
|
||||
return
|
||||
|
||||
# byte[] -- the raw data
|
||||
array = rdat.getByteData()
|
||||
arraySize = len(array)
|
||||
if xLen * yLen != arraySize:
|
||||
return ResponseMessageGeneric(msg)
|
||||
description = user_args.description
|
||||
if not description:
|
||||
print >> sys.stderr, "Description not provided"
|
||||
return
|
||||
|
||||
# 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"
|
||||
format = user_args.extended
|
||||
|
||||
# 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"
|
||||
|
||||
# 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"
|
||||
print_record(records[0], format, description)
|
||||
|
||||
# Encode product dependent parameters 17 through 26
|
||||
nnn = len(depVals)
|
||||
j = 0
|
||||
while j<nnn :
|
||||
msg += " " + str(depVals[j])
|
||||
j += 1
|
||||
msg += "\n"
|
||||
|
||||
if dattyp == "radial" :
|
||||
j = 0
|
||||
while j<azValsLen :
|
||||
msg += "%.1f"%azVals[j] + " "
|
||||
j += 1
|
||||
msg += "\n"
|
||||
def print_record(record, format, description):
|
||||
idra = record.getHdf5Data()
|
||||
|
||||
nxy = yLen*xLen
|
||||
j = 0
|
||||
while j<nxy :
|
||||
i = 0
|
||||
while i<xLen :
|
||||
if array[i+j]<0 :
|
||||
msg += str(256+array[i+j]) + " "
|
||||
else :
|
||||
msg += str(array[i+j]) + " "
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
rdat,azdat,depVals,threshVals = a2radcommon.get_hdf5_data(idra)
|
||||
|
||||
if not rdat:
|
||||
# Graphic, XY
|
||||
# print "Unsupported radar format"
|
||||
return
|
||||
|
||||
return ResponseMessageGeneric(msg)
|
||||
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 = a2radcommon.get_header(record, format, xLen, yLen, azdat, description)
|
||||
|
||||
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)
|
||||
|
||||
print msg
|
||||
|
||||
|
||||
def encode_data(yLen, xLen, array):
|
||||
nxy = yLen*xLen
|
||||
j = 0
|
||||
msg = ""
|
||||
while j<nxy :
|
||||
i = 0
|
||||
while i<xLen :
|
||||
if array[i+j]<0 :
|
||||
msg += str(256+array[i+j]) + " "
|
||||
else :
|
||||
msg += str(array[i+j]) + " "
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
return msg[0:-1]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
#
|
||||
|
||||
cd $UE_BIN_PATH
|
||||
( uengine -r python < $specpy ) | grep -v '<' | sed 's/>/>/g' | \
|
||||
sed 's/</</g' | grep -v Response
|
||||
|
||||
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
|
||||
endif
|
||||
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
|
||||
|
||||
#
|
||||
|
|
|
@ -1,208 +1,166 @@
|
|||
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()
|
||||
|
||||
dim = rdat.getDimension()
|
||||
if dim != 2:
|
||||
return ResponseMessageGeneric(msg)
|
||||
records = a2radcommon.send_request(user_args)
|
||||
|
||||
yLen = rdat.getSizes()[0]
|
||||
xLen = rdat.getSizes()[1]
|
||||
if not records:
|
||||
# print "Data not available"
|
||||
return
|
||||
|
||||
# byte[] -- the raw data
|
||||
array = rdat.getByteData()
|
||||
arraySize = len(array)
|
||||
if xLen * yLen != arraySize:
|
||||
return ResponseMessageGeneric(msg)
|
||||
description = user_args.description
|
||||
if not description:
|
||||
print >> sys.stderr, "Description not provided"
|
||||
return
|
||||
|
||||
# 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"
|
||||
format = user_args.extended
|
||||
encoding = user_args.encoding
|
||||
|
||||
# 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"
|
||||
|
||||
# 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"
|
||||
print_record(records[0], format, description, encoding)
|
||||
|
||||
# Encode product dependent parameters 17 through 26
|
||||
nnn = len(depVals)
|
||||
j = 0
|
||||
while j<nnn :
|
||||
msg += " " + str(depVals[j])
|
||||
j += 1
|
||||
msg += "\n"
|
||||
|
||||
if dattyp == "radial" :
|
||||
j = 0
|
||||
while j<azValsLen :
|
||||
msg += "%.1f"%azVals[j] + " "
|
||||
j += 1
|
||||
msg += "\n"
|
||||
def print_record(record, format, description, encoding):
|
||||
|
||||
plus = " ghijklmnopqrstuvwxyz"
|
||||
minus = " GHIJKLMNOPQRSTUVWXYZ"
|
||||
nxy = yLen*xLen
|
||||
j = 0
|
||||
while j<nxy :
|
||||
i = 0
|
||||
kk = array[i+j]
|
||||
if kk<0 : kk += 256
|
||||
if encoding == 0 :
|
||||
msg += str(kk)
|
||||
elif encoding == 1 :
|
||||
msg += "%2.2x"%kk
|
||||
elif kk == 0 :
|
||||
msg += "@"
|
||||
elif kk == 255 :
|
||||
msg += "#"
|
||||
else :
|
||||
msg += "%2.2x"%kk
|
||||
i += 1
|
||||
while i<xLen :
|
||||
k = array[i+j]
|
||||
if k<0 : kk += 256
|
||||
if encoding == 0 :
|
||||
msg += " "+str(k)
|
||||
elif encoding == 1 :
|
||||
msg += "%2.2x"%k
|
||||
elif k==0 :
|
||||
msg += "@"
|
||||
elif k == 255 :
|
||||
msg += "#"
|
||||
elif k==kk :
|
||||
msg += "."
|
||||
elif k>kk+20 or k<kk-20 :
|
||||
msg += "%2.2x"%k
|
||||
elif k>kk :
|
||||
msg += plus[k-kk]
|
||||
else :
|
||||
msg += minus[kk-k]
|
||||
kk = k
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
idra = record.getHdf5Data()
|
||||
|
||||
return ResponseMessageGeneric(msg)
|
||||
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:
|
||||
# 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 = a2radcommon.get_header(record, format, xLen, yLen, azdat, description)
|
||||
|
||||
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)
|
||||
|
||||
print msg.strip()
|
||||
|
||||
|
||||
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]
|
||||
if kk<0 : kk += 256
|
||||
if encoding == 0 :
|
||||
msg += str(kk)
|
||||
elif encoding == 1 :
|
||||
msg += "%2.2x"%kk
|
||||
elif kk == 0 :
|
||||
msg += "@"
|
||||
elif kk == 255 :
|
||||
msg += "#"
|
||||
else :
|
||||
msg += "%2.2x"%kk
|
||||
i += 1
|
||||
while i<xLen :
|
||||
k = array[i+j]
|
||||
if k<0 : kk += 256
|
||||
if encoding == 0 :
|
||||
msg += " "+str(k)
|
||||
elif encoding == 1 :
|
||||
msg += "%2.2x"%k
|
||||
elif k==0 :
|
||||
msg += "@"
|
||||
elif k == 255 :
|
||||
msg += "#"
|
||||
elif k==kk :
|
||||
msg += "."
|
||||
elif k>kk+20 or k<kk-20 :
|
||||
msg += "%2.2x"%k
|
||||
elif k>kk :
|
||||
msg += plus[k-kk]
|
||||
else :
|
||||
msg += minus[kk-k]
|
||||
kk = k
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
return msg
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
|
@ -1,109 +1,165 @@
|
|||
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"
|
||||
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()
|
||||
|
||||
dim = rdat.getDimension()
|
||||
if dim != 2:
|
||||
return ResponseMessageGeneric(msg)
|
||||
records = a2radcommon.send_request(user_args)
|
||||
|
||||
yLen = rdat.getSizes()[0]
|
||||
xLen = rdat.getSizes()[1]
|
||||
if not records:
|
||||
# print "Data not available"
|
||||
return
|
||||
|
||||
# byte[] -- the raw data
|
||||
array = rdat.getByteData()
|
||||
arraySize = len(array)
|
||||
if xLen * yLen != arraySize:
|
||||
return ResponseMessageGeneric(msg)
|
||||
description = user_args.description
|
||||
if not description:
|
||||
print >> sys.stderr, "Description not provided"
|
||||
return
|
||||
|
||||
# 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"
|
||||
print_record(records[0], description)
|
||||
|
||||
msg = "\n"+ str(xLen) + " " + str(yLen) + " " + mytime + " " + dattyp + \
|
||||
" " + description + "\n"
|
||||
msg += str(rrec.getTrueElevationAngle()) + " " + \
|
||||
str(rrec.getVolumeCoveragePattern()) + "\n"
|
||||
|
||||
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]
|
||||
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()
|
||||
|
||||
return rdat,azdat,depVals,prodVals,recVals,stormVals,symVals,symData,threshVals
|
||||
|
||||
|
||||
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)
|
||||
|
||||
msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + dattyp + \
|
||||
" " + description + "\n" + \
|
||||
str(record.getTrueElevationAngle()) + " " + \
|
||||
str(record.getVolumeCoveragePattern()) + "\n"
|
||||
return msg
|
||||
|
||||
|
||||
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,60 +238,30 @@ 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
|
||||
|
||||
nxy = yLen*xLen
|
||||
j = 0
|
||||
while j<nxy :
|
||||
i = 0
|
||||
while i<xLen :
|
||||
if array[i+j]<0 :
|
||||
msg += str(256+array[i+j]) + " "
|
||||
else :
|
||||
msg += str(array[i+j]) + " "
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
|
||||
return ResponseMessageGeneric(msg)
|
||||
def encode_data(yLen, xLen, array):
|
||||
msg = ""
|
||||
nxy = yLen*xLen
|
||||
j = 0
|
||||
while j<nxy :
|
||||
i = 0
|
||||
while i<xLen :
|
||||
if array[i+j]<0 :
|
||||
msg += str(256+array[i+j]) + " "
|
||||
else :
|
||||
msg += str(array[i+j]) + " "
|
||||
i += 1
|
||||
msg += "\n"
|
||||
j += xLen
|
||||
return msg[0:-1]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
251
pythonPackages/msaslaps/radar/a2radcommon.py
Normal file
251
pythonPackages/msaslaps/radar/a2radcommon.py
Normal 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
|
||||
|
Loading…
Add table
Reference in a new issue