Issue #2023: Pure python client implementation of Data Access Framework.

Change-Id: I801b88192aafb4b139b5a1b397b33620c0b9f427

Former-commit-id: 2c0af328b6 [formerly ae3e7a64b0] [formerly 4bdf7178bd [formerly edc77397fb74f07c66dd9f7b9ede5e8af81b4b18]]
Former-commit-id: 4bdf7178bd
Former-commit-id: 3f4b44fbbc
This commit is contained in:
David Gillingham 2013-06-03 16:17:04 -05:00
parent b056cb499d
commit 242d3a5493
58 changed files with 2763 additions and 34 deletions

View file

@ -28,7 +28,7 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 12/10/12 njensen Initial Creation.
#
# 06/03/13 #2023 dgilling Implement getAttributes().
#
#
@ -43,6 +43,14 @@ class JData(IData, JUtil.JavaWrapperClass):
def getAttribute(self, key):
return self.jobj.getAttribute(key)
def getAttributes(self):
attributes = []
jattribs = self.jobj.getAttributes()
itr = jattribs.iterator()
while itr.hasNext():
attributes.append(str(itr.next()))
return attributes
def getDataTime(self):
return DataTime.DataTime(self.jobj.getDataTime())

View file

@ -28,7 +28,8 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 12/10/12 njensen Initial Creation.
#
# 06/03/13 #2023 dgilling Remove "unit" support from
# __getitem__ as it only threw errors.
#
#
@ -46,8 +47,6 @@ class JGeometryData(IGeometryData, JData.JData):
return self.getGeometry()
elif key == 'parameters':
return self.getParameters()
elif key == 'unit':
return self.getUnit()
elif key =='locationName':
return self.getLocationName()
elif key == 'time':

View file

@ -21,4 +21,6 @@ Export-Package: com.raytheon.uf.common.dataaccess,
com.raytheon.uf.common.dataaccess.geom,
com.raytheon.uf.common.dataaccess.grid,
com.raytheon.uf.common.dataaccess.impl,
com.raytheon.uf.common.dataaccess.request,
com.raytheon.uf.common.dataaccess.response,
com.raytheon.uf.common.dataaccess.util

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.common.dataaccess;
import java.util.Set;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.time.DataTime;
@ -33,6 +35,7 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 10, 2012 njensen Initial creation
* Jun 03, 2013 #2023 dgilling Add getAttributes().
*
* </pre>
*
@ -50,6 +53,13 @@ public interface IData {
*/
public Object getAttribute(String key);
/**
* Gets the list of attributes associated with this data.
*
* @return the attributes
*/
public Set<String> getAttributes();
/**
* Gets the DataTime of the data. May be null if the data is time agnostic.
*

View file

@ -31,6 +31,8 @@ import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.serialization.XmlGenericMapAdapter;
import com.raytheon.uf.common.serialization.adapters.JTSEnvelopeAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Envelope;
/**
@ -43,9 +45,10 @@ import com.vividsolutions.jts.geom.Envelope;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 6, 2012 njensen Initial creation
* Nov 06, 2012 njensen Initial creation
* Feb 14, 2013 1614 bsteffen Refactor data access framework to use
* single request.
* May 28, 2013 2023 dgilling Add support for DynamicSerialize.
*
* </pre>
*
@ -54,30 +57,39 @@ import com.vividsolutions.jts.geom.Envelope;
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DefaultDataRequest implements IDataRequest {
@XmlElement
@DynamicSerializeElement
protected String datatype;
@XmlJavaTypeAdapter(value = XmlGenericMapAdapter.class)
@DynamicSerializeElement
protected Map<String, Object> identifiers;
@XmlElement(name = "parameter")
@DynamicSerializeElement
protected String[] parameters;
@XmlElement(name = "level")
@DynamicSerializeElement
protected Level[] levels;
@XmlElement(name = "locationName")
@DynamicSerializeElement
protected String[] locationNames;
@XmlJavaTypeAdapter(value = JTSEnvelopeAdapter.class)
@DynamicSerializeElement
protected Envelope envelope;
@Override
public void setDatatype(String datatype) {
this.datatype = datatype;
}
@Override
public void addIdentifier(String key, Object value) {
if (identifiers == null) {
identifiers = new HashMap<String, Object>();
@ -85,46 +97,58 @@ public class DefaultDataRequest implements IDataRequest {
identifiers.put(key, value);
}
public void setIdentifiers(Map<String, Object> identifiers) {
this.identifiers = identifiers;
}
@Override
public void setParameters(String... params) {
this.parameters = params;
}
@Override
public void setLevels(Level... levels) {
this.levels = levels;
}
@Override
public void setLocationNames(String... locationNames) {
this.locationNames = locationNames;
}
@Override
public void setEnvelope(Envelope env) {
this.envelope = env;
}
@Override
public String getDatatype() {
return datatype;
}
@Override
public Map<String, Object> getIdentifiers() {
return identifiers;
}
@Override
public String[] getParameters() {
return parameters;
}
@Override
public Level[] getLevels() {
return levels;
}
@Override
public String[] getLocationNames() {
return locationNames;
}
@Override
public Envelope getEnvelope() {
return envelope;
}
}

View file

@ -41,7 +41,8 @@ import com.vividsolutions.jts.geom.Geometry;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2012 njensen Initial creation
* Nov 09, 2012 njensen Initial creation
* Jun 03, 2013 #2023 dgilling Implement getAttributes().
*
* </pre>
*
@ -83,6 +84,11 @@ public class DefaultGeometryData implements IGeometryData {
return result;
}
@Override
public Set<String> getAttributes() {
return attributes.keySet();
}
@Override
public DataTime getDataTime() {
return time;
@ -290,5 +296,4 @@ public class DefaultGeometryData implements IGeometryData {
public void setAttributes(Map<String, Object> attrs) {
this.attributes = attrs;
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.dataaccess.impl;
import java.util.Map;
import java.util.Set;
import javax.measure.unit.Unit;
@ -41,7 +42,8 @@ import com.raytheon.uf.common.time.DataTime;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 5, 2012 njensen Initial creation
* Nov 05, 2012 njensen Initial creation
* Jun 03, 2013 #2023 dgilling Implement getAttributes().
*
* </pre>
*
@ -81,6 +83,11 @@ public class DefaultGridData implements IGridData {
return result;
}
@Override
public Set<String> getAttributes() {
return attributes.keySet();
}
@Override
public DataTime getDataTime() {
return time;

View file

@ -0,0 +1,66 @@
/**
* 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.dataaccess.request;
import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Abstract base class for Thrift requests made to the Data Access Framework.
* Primarily used by the Python-Thrift implementation.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public abstract class AbstractDataAccessRequest implements IServerRequest {
@DynamicSerializeElement
protected IDataRequest requestParameters;
protected AbstractDataAccessRequest() {
// no-op for serialization
}
protected AbstractDataAccessRequest(final IDataRequest request) {
requestParameters = request;
}
public IDataRequest getRequestParameters() {
return requestParameters;
}
public void setRequestParameters(final IDataRequest requestParameters) {
this.requestParameters = requestParameters;
}
}

View file

@ -0,0 +1,54 @@
/**
* 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.dataaccess.request;
import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Thrift request to retrieve list of available location names from Data Access
* Framework.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 24, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public final class GetAvailableLocationNamesRequest extends
AbstractDataAccessRequest {
public GetAvailableLocationNamesRequest() {
super();
}
public GetAvailableLocationNamesRequest(final IDataRequest request) {
super(request);
}
}

View file

@ -0,0 +1,53 @@
/**
* 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.dataaccess.request;
import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Thrift request to retrieve list of available times for data from the Data
* Access Framework.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public final class GetAvailableTimesRequest extends AbstractDataAccessRequest {
public GetAvailableTimesRequest() {
super();
}
public GetAvailableTimesRequest(final IDataRequest request) {
super(request);
}
}

View file

@ -0,0 +1,87 @@
/**
* 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.dataaccess.request;
import java.util.Collections;
import java.util.List;
import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
/**
* Thrift request to retrieve geometry data from the Data Access Framework.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 24, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public final class GetGeometryDataRequest extends AbstractDataAccessRequest {
private List<DataTime> requestedTimes;
private TimeRange requestedPeriod;
public GetGeometryDataRequest() {
// no-op, for serialization
}
public GetGeometryDataRequest(final IDataRequest request,
final List<DataTime> requestedTimes) {
super(request);
this.requestedTimes = requestedTimes;
this.requestedPeriod = null;
}
public GetGeometryDataRequest(final IDataRequest request,
final TimeRange requestedPeriod) {
super(request);
this.requestedPeriod = requestedPeriod;
this.requestedTimes = Collections.emptyList();
}
public List<DataTime> getRequestedTimes() {
return requestedTimes;
}
public void setRequestedTimes(List<DataTime> requestedTimes) {
this.requestedTimes = requestedTimes;
}
public TimeRange getRequestedPeriod() {
return requestedPeriod;
}
public void setRequestedPeriod(TimeRange requestedPeriod) {
this.requestedPeriod = requestedPeriod;
}
}

View file

@ -0,0 +1,87 @@
/**
* 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.dataaccess.request;
import java.util.Collections;
import java.util.List;
import com.raytheon.uf.common.dataaccess.IDataRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
/**
* Thrift request to retrieve gridded data from the Data Access Framework.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 24, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public final class GetGridDataRequest extends AbstractDataAccessRequest {
private List<DataTime> requestedTimes;
private TimeRange requestedPeriod;
public GetGridDataRequest() {
// no-op, for serialization
}
public GetGridDataRequest(final IDataRequest request,
final List<DataTime> requestedTimes) {
super(request);
this.requestedTimes = requestedTimes;
this.requestedPeriod = null;
}
public GetGridDataRequest(final IDataRequest request,
final TimeRange requestedPeriod) {
super(request);
this.requestedPeriod = requestedPeriod;
this.requestedTimes = Collections.emptyList();
}
public List<DataTime> getRequestedTimes() {
return requestedTimes;
}
public void setRequestedTimes(List<DataTime> requestedTimes) {
this.requestedTimes = requestedTimes;
}
public TimeRange getRequestedPeriod() {
return requestedPeriod;
}
public void setRequestedPeriod(TimeRange requestedPeriod) {
this.requestedPeriod = requestedPeriod;
}
}

View file

@ -0,0 +1,112 @@
/**
* 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.dataaccess.response;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.dataaccess.IData;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
/**
* Base class for responses returned from the Data Access Framework. Wraps all
* of the data for the <code>IData</code> interface.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 4, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public abstract class AbstractResponseData {
@DynamicSerializeElement
protected DataTime time;
@DynamicSerializeElement
protected String level;
@DynamicSerializeElement
protected String locationName;
@DynamicSerializeElement
protected Map<String, Object> attributes;
protected AbstractResponseData() {
// no-op, for serialization
}
protected AbstractResponseData(final IData data) {
time = data.getDataTime();
locationName = data.getLocationName();
if (data.getLevel() != null) {
level = data.getLevel().toString();
}
Set<String> attrNames = data.getAttributes();
attributes = new HashMap<String, Object>(attrNames.size(), 1);
for (String attr : attrNames) {
attributes.put(attr, data.getAttribute(attr));
}
}
public DataTime getTime() {
return time;
}
public void setTime(DataTime time) {
this.time = time;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public Map<String, Object> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
}

View file

@ -0,0 +1,96 @@
/**
* 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.dataaccess.response;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.dataaccess.geom.IGeometryData;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* IGeometryData wrapper used as part of <code>GetGeometryDataResponse</code>.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 03, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class GeometryResponseData extends AbstractResponseData {
@DynamicSerializeElement
private Map<String, Object[]> dataMap;
@DynamicSerializeElement
private String geometryWKT;
public GeometryResponseData() {
// no-op, for serialization
}
public GeometryResponseData(final IGeometryData data) {
super(data);
Set<String> parameters = data.getParameters();
dataMap = new HashMap<String, Object[]>(parameters.size(), 1);
for (String param : parameters) {
Object[] dataTuple = new Object[3];
if (IGeometryData.Type.STRING.equals(data.getType(param))) {
dataTuple[0] = data.getString(param);
} else {
dataTuple[0] = data.getNumber(param);
}
dataTuple[1] = data.getType(param).toString();
if (data.getUnit(param) != null) {
dataTuple[2] = data.getUnit(param).toString();
}
dataMap.put(param, dataTuple);
}
geometryWKT = data.getGeometry().toText();
}
public Map<String, Object[]> getDataMap() {
return dataMap;
}
public void setDataMap(Map<String, Object[]> dataMap) {
this.dataMap = dataMap;
}
public String getGeometryWKT() {
return geometryWKT;
}
public void setGeometryWKT(String geometry) {
this.geometryWKT = geometry;
}
}

View file

@ -0,0 +1,71 @@
/**
* 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.dataaccess.response;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.raytheon.uf.common.dataaccess.geom.IGeometryData;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Response for <code>GetGeometryDataRequest</code>.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 3, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class GetGeometryDataResponse {
@DynamicSerializeElement
private List<GeometryResponseData> geoData;
public GetGeometryDataResponse() {
// no-op, for serialization only
}
public GetGeometryDataResponse(final Collection<IGeometryData> geoData) {
this.geoData = new ArrayList<GeometryResponseData>(geoData.size());
for (IGeometryData element : geoData) {
this.geoData.add(new GeometryResponseData(element));
}
}
public List<GeometryResponseData> getGeoData() {
return geoData;
}
public void setGeoData(List<GeometryResponseData> geoData) {
this.geoData = geoData;
}
}

View file

@ -0,0 +1,139 @@
/**
* 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.dataaccess.response;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.geotools.coverage.grid.GridGeometry2D;
import org.opengis.coverage.grid.GridEnvelope;
import com.raytheon.uf.common.dataaccess.grid.IGridData;
import com.raytheon.uf.common.geospatial.LatLonReprojection;
import com.raytheon.uf.common.geospatial.LatLonWrapper;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Response for <code>GetGridDataRequest</code>.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 4, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class GetGridDataResponse {
@DynamicSerializeElement
private List<GridResponseData> gridData;
@DynamicSerializeElement
private Map<String, Integer> siteNxValues;
@DynamicSerializeElement
private Map<String, Integer> siteNyValues;
@DynamicSerializeElement
private Map<String, float[]> siteLatGrids;
@DynamicSerializeElement
private Map<String, float[]> siteLonGrids;
public GetGridDataResponse() {
// no-op, for serialization only
}
public GetGridDataResponse(final Collection<IGridData> gridData) {
this.gridData = new ArrayList<GridResponseData>(gridData.size());
siteNxValues = new HashMap<String, Integer>(gridData.size(), 1);
siteNyValues = new HashMap<String, Integer>(gridData.size(), 1);
siteLatGrids = new HashMap<String, float[]>(gridData.size(), 1);
siteLonGrids = new HashMap<String, float[]>(gridData.size(), 1);
for (IGridData grid : gridData) {
this.gridData.add(new GridResponseData(grid));
String locationName = grid.getLocationName();
if (!siteNxValues.containsKey(locationName)) {
GridGeometry2D gridGeometry = grid.getGridGeometry();
GridEnvelope gridShape = gridGeometry.getGridRange();
siteNxValues.put(locationName, gridShape.getSpan(0));
siteNyValues.put(locationName, gridShape.getSpan(1));
LatLonWrapper latLonData = LatLonReprojection
.getLatLons(gridGeometry);
siteLatGrids.put(locationName, latLonData.getLats());
siteLonGrids.put(locationName, latLonData.getLons());
}
}
}
public List<GridResponseData> getGridData() {
return gridData;
}
public void setGridData(List<GridResponseData> gridData) {
this.gridData = gridData;
}
public Map<String, Integer> getSiteNxValues() {
return siteNxValues;
}
public void setSiteNxValues(Map<String, Integer> siteNxValues) {
this.siteNxValues = siteNxValues;
}
public Map<String, Integer> getSiteNyValues() {
return siteNyValues;
}
public void setSiteNyValues(Map<String, Integer> siteNyValues) {
this.siteNyValues = siteNyValues;
}
public Map<String, float[]> getSiteLatGrids() {
return siteLatGrids;
}
public void setSiteLatGrids(Map<String, float[]> siteLatGrids) {
this.siteLatGrids = siteLatGrids;
}
public Map<String, float[]> getSiteLonGrids() {
return siteLonGrids;
}
public void setSiteLonGrids(Map<String, float[]> siteLonGrids) {
this.siteLonGrids = siteLonGrids;
}
}

View file

@ -0,0 +1,96 @@
/**
* 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.dataaccess.response;
import com.raytheon.uf.common.dataaccess.grid.IGridData;
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* IGridData wrapper used as part of <code>GetGridDataResponse</code>.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 4, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
@DynamicSerialize
public class GridResponseData extends AbstractResponseData {
@DynamicSerializeElement
private String parameter;
@DynamicSerializeElement
private String unit;
@DynamicSerializeElement
private float[] gridData;
public GridResponseData() {
// no-op, for serialization
}
public GridResponseData(final IGridData data) {
super(data);
parameter = data.getParameter();
if (data.getUnit() != null) {
unit = data.getUnit().toString();
}
FloatArrayWrapper dataGrid = new FloatArrayWrapper(
data.getGridGeometry());
dataGrid = data.populateData(dataGrid);
gridData = dataGrid.getArray();
}
public String getParameter() {
return parameter;
}
public void setParameter(String parameter) {
this.parameter = parameter;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public float[] getGridData() {
return gridData;
}
public void setGridData(float[] gridData) {
this.gridData = gridData;
}
}

View file

@ -111,4 +111,11 @@
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.edex.dataaccess"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.dataaccess</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Data Access Framework EDEX
Bundle-SymbolicName: com.raytheon.uf.edex.dataaccess
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Require-Bundle: com.raytheon.uf.common.dataaccess,
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.util;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy

View file

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

View file

@ -0,0 +1,37 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="availableLocationsHandler"
class="com.raytheon.uf.edex.dataaccess.handler.GetAvailableLocationNamesHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.dataaccess.request.GetAvailableLocationNamesRequest" />
<constructor-arg ref="availableLocationsHandler" />
</bean>
<bean id="availableTimesHandler"
class="com.raytheon.uf.edex.dataaccess.handler.GetAvailableTimesHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.dataaccess.request.GetAvailableTimesRequest" />
<constructor-arg ref="availableTimesHandler" />
</bean>
<bean id="getGeometryDataHandler"
class="com.raytheon.uf.edex.dataaccess.handler.GetGeometryDataHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.dataaccess.request.GetGeometryDataRequest" />
<constructor-arg ref="getGeometryDataHandler" />
</bean>
<bean id="getGridDataHandler"
class="com.raytheon.uf.edex.dataaccess.handler.GetGridDataHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.dataaccess.request.GetGridDataRequest" />
<constructor-arg ref="getGridDataHandler" />
</bean>
</beans>

View file

@ -0,0 +1,60 @@
/**
* 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.edex.dataaccess.handler;
import com.raytheon.uf.common.dataaccess.DataAccessLayer;
import com.raytheon.uf.common.dataaccess.request.GetAvailableLocationNamesRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
/**
* Request handler for <code>GetAvailableLocationNamesRequest</code>. Returns
* answer as array of <code>String</code> objects containing the location names.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 24, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class GetAvailableLocationNamesHandler implements
IRequestHandler<GetAvailableLocationNamesRequest> {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
*/
@Override
public String[] handleRequest(final GetAvailableLocationNamesRequest request)
throws Exception {
return DataAccessLayer.getAvailableLocationNames(request
.getRequestParameters());
}
}

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.
**/
package com.raytheon.uf.edex.dataaccess.handler;
import com.raytheon.uf.common.dataaccess.DataAccessLayer;
import com.raytheon.uf.common.dataaccess.request.GetAvailableTimesRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.time.DataTime;
/**
* Request handler for <code>GetAvailableTimesRequest</code>. Returns answer as
* array of <code>DataTime</code> objects.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class GetAvailableTimesHandler implements
IRequestHandler<GetAvailableTimesRequest> {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
*/
@Override
public DataTime[] handleRequest(final GetAvailableTimesRequest request)
throws Exception {
return DataAccessLayer
.getAvailableTimes(request.getRequestParameters());
}
}

View file

@ -0,0 +1,79 @@
/**
* 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.edex.dataaccess.handler;
import java.util.Arrays;
import com.raytheon.uf.common.dataaccess.DataAccessLayer;
import com.raytheon.uf.common.dataaccess.geom.IGeometryData;
import com.raytheon.uf.common.dataaccess.request.GetGeometryDataRequest;
import com.raytheon.uf.common.dataaccess.response.GetGeometryDataResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.util.CollectionUtil;
/**
* Request handler for <code>GetGeometryDataRequest</code>. Data returned is in
* form of <code>GetGeometryDataResponse</code> objects.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 30, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class GetGeometryDataHandler implements
IRequestHandler<GetGeometryDataRequest> {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
*/
@Override
public GetGeometryDataResponse handleRequest(
final GetGeometryDataRequest request) throws Exception {
IGeometryData[] geoData = new IGeometryData[0];
if (!CollectionUtil.isNullOrEmpty(request.getRequestedTimes())) {
geoData = DataAccessLayer.getGeometryData(request
.getRequestParameters(), request.getRequestedTimes()
.toArray(new DataTime[request.getRequestedTimes().size()]));
} else {
geoData = DataAccessLayer.getGeometryData(
request.getRequestParameters(),
request.getRequestedPeriod());
}
GetGeometryDataResponse response = new GetGeometryDataResponse(
Arrays.asList(geoData));
return response;
}
}

View file

@ -0,0 +1,79 @@
/**
* 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.edex.dataaccess.handler;
import java.util.Arrays;
import com.raytheon.uf.common.dataaccess.DataAccessLayer;
import com.raytheon.uf.common.dataaccess.grid.IGridData;
import com.raytheon.uf.common.dataaccess.request.GetGridDataRequest;
import com.raytheon.uf.common.dataaccess.response.GetGridDataResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.util.CollectionUtil;
/**
* Request handler for <code>GetGridDataRequest</code>. Data returned is in form
* of <code>GetGridDataResponse</code> objects.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 4, 2013 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class GetGridDataHandler implements
IRequestHandler<GetGridDataRequest> {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
*/
@Override
public GetGridDataResponse handleRequest(final GetGridDataRequest request)
throws Exception {
IGridData[] gridData = new IGridData[0];
if (!CollectionUtil.isNullOrEmpty(request.getRequestedTimes())) {
gridData = DataAccessLayer.getGridData(request
.getRequestParameters(), request.getRequestedTimes()
.toArray(new DataTime[request.getRequestedTimes().size()]));
} else {
gridData = DataAccessLayer.getGridData(
request.getRequestParameters(),
request.getRequestedPeriod());
}
GetGridDataResponse response = new GetGridDataResponse(
Arrays.asList(gridData));
return response;
}
}

View file

@ -0,0 +1,51 @@
##
# 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.
##
#
# Adapter for com.vividsolutions.jts.geom.Envelope
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Envelope
ClassAdapter = 'com.vividsolutions.jts.geom.Envelope'
def serialize(context, envelope):
context.writeDouble(envelope.getMinX())
context.writeDouble(envelope.getMaxX())
context.writeDouble(envelope.getMinY())
context.writeDouble(envelope.getMaxY())
def deserialize(context):
env = Envelope()
env.setMinX(context.readDouble())
env.setMaxX(context.readDouble())
env.setMinY(context.readDouble())
env.setMaxY(context.readDouble())
return env

View file

@ -24,6 +24,7 @@ __all__ = [
'activetable',
'alertviz',
'auth',
'dataaccess',
'dataplugin',
'datastorage',
'localization',

View file

@ -0,0 +1,29 @@
##
# 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__ = [
'impl',
'request',
'response'
]

View file

@ -0,0 +1,91 @@
##
# 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
# and then modified post-generation to sub-class IDataRequest.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 2023 dgilling Initial Creation.
#
#
from ufpy.dataaccess import IDataRequest
from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Envelope
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level
class DefaultDataRequest(IDataRequest):
def __init__(self):
self.datatype = None
self.identifiers = {}
self.parameters = []
self.levels = []
self.locationNames = []
self.envelope = None
def setDatatype(self, datatype):
self.datatype = str(datatype)
def addIdentifier(self, key, value):
self.identifiers[key] = value
def setParameters(self, *params):
self.parameters = map(str, params)
def setLevels(self, *levels):
self.levels = map(self.__makeLevel, levels)
def __makeLevel(self, level):
if type(level) is Level:
return level
elif type(level) is str:
return Level(level)
else:
raise TypeError("Invalid object type specified for level.")
def setEnvelope(self, env):
self.envelope = Envelope(env.envelope)
def setLocationNames(self, *locationNames):
self.locationNames = map(str, locationNames)
def getDatatype(self):
return self.datatype
def getIdentifiers(self):
return self.identifiers
def getParameters(self):
return self.parameters
def getLevels(self):
return self.levels
def getEnvelope(self):
return self.envelope
def getLocationNames(self):
return self.locationNames

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__ = [
'DefaultDataRequest'
]
from DefaultDataRequest import DefaultDataRequest

View file

@ -0,0 +1,46 @@
##
# 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
# and then modified post-generation to make it a abstract base class.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 #2023 dgilling Initial Creation.
#
#
import abc
class AbstractDataAccessRequest(object):
__metaclass__ = abc.ABCMeta
def __init__(self):
self.requestParameters = None
def getRequestParameters(self):
return self.requestParameters
def setRequestParameters(self, requestParameters):
self.requestParameters = requestParameters

View file

@ -0,0 +1,40 @@
##
# 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
# and then modified post-generation to make it sub class
# AbstractDataAccessRequest.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest
class GetAvailableLocationNamesRequest(AbstractDataAccessRequest):
def __init__(self):
super(GetAvailableLocationNamesRequest, self).__init__()

View file

@ -0,0 +1,41 @@
##
# 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
# and then modified post-generation to make it sub class
# AbstractDataAccessRequest.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest
class GetAvailableTimesRequest(AbstractDataAccessRequest):
def __init__(self):
super(GetAvailableTimesRequest, self).__init__()

View file

@ -0,0 +1,54 @@
##
# 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
# and then modified post-generation to make it sub class
# AbstractDataAccessRequest.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest
class GetGeometryDataRequest(AbstractDataAccessRequest):
def __init__(self):
super(GetGeometryDataRequest, self).__init__()
self.requestedTimes = None
self.requestedPeriod = None
def getRequestedTimes(self):
return self.requestedTimes
def setRequestedTimes(self, requestedTimes):
self.requestedTimes = requestedTimes
def getRequestedPeriod(self):
return self.requestedPeriod
def setRequestedPeriod(self, requestedPeriod):
self.requestedPeriod = requestedPeriod

View file

@ -0,0 +1,53 @@
##
# 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
# and then modified post-generation to make it sub class
# AbstractDataAccessRequest.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/28/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest
class GetGridDataRequest(AbstractDataAccessRequest):
def __init__(self):
super(GetGridDataRequest, self).__init__()
self.requestedTimes = None
self.requestedPeriod = None
def getRequestedTimes(self):
return self.requestedTimes
def setRequestedTimes(self, requestedTimes):
self.requestedTimes = requestedTimes
def getRequestedPeriod(self):
return self.requestedPeriod
def setRequestedPeriod(self, requestedPeriod):
self.requestedPeriod = requestedPeriod

View file

@ -0,0 +1,36 @@
##
# 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__ = [
'AbstractDataAccessRequest',
'GetAvailableLocationNamesRequest',
'GetAvailableTimesRequest',
'GetGeometryDataRequest',
'GetGridDataRequest'
]
from AbstractDataAccessRequest import AbstractDataAccessRequest
from GetAvailableLocationNamesRequest import GetAvailableLocationNamesRequest
from GetAvailableTimesRequest import GetAvailableTimesRequest
from GetGeometryDataRequest import GetGeometryDataRequest
from GetGridDataRequest import GetGridDataRequest

View file

@ -0,0 +1,59 @@
##
# 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
import abc
class AbstractResponseData(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
self.time = None
self.level = None
self.locationName = None
self.attributes = None
def getTime(self):
return self.time
def setTime(self, time):
self.time = time
def getLevel(self):
return self.level
def setLevel(self, level):
self.level = level
def getLocationName(self):
return self.locationName
def setLocationName(self, locationName):
self.locationName = locationName
def getAttributes(self):
return self.attributes
def setAttributes(self, attributes):
self.attributes = attributes

View file

@ -0,0 +1,52 @@
##
# 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
# and then modified post-generation to use AbstractResponseData.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/04/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData
class GeometryResponseData(AbstractResponseData):
def __init__(self):
super(GeometryResponseData, self).__init__()
self.dataMap = None
self.geometryWKT = None
def getDataMap(self):
return self.dataMap
def setDataMap(self, dataMap):
self.dataMap = dataMap
def getGeometryWKT(self):
return self.geometryWKT
def setGeometryWKT(self, geometryWKT):
self.geometryWKT = geometryWKT

View file

@ -0,0 +1,33 @@
##
# 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
class GetGeometryDataResponse(object):
def __init__(self):
self.geoData = None
def getGeoData(self):
return self.geoData
def setGeoData(self, geoData):
self.geoData = geoData

View file

@ -0,0 +1,61 @@
##
# 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
class GetGridDataResponse(object):
def __init__(self):
self.gridData = None
self.siteNxValues = None
self.siteNyValues = None
self.siteLatGrids = None
self.siteLonGrids = None
def getGridData(self):
return self.gridData
def setGridData(self, gridData):
self.gridData = gridData
def getSiteNxValues(self):
return self.siteNxValues
def setSiteNxValues(self, siteNxValues):
self.siteNxValues = siteNxValues
def getSiteNyValues(self):
return self.siteNyValues
def setSiteNyValues(self, siteNyValues):
self.siteNyValues = siteNyValues
def getSiteLatGrids(self):
return self.siteLatGrids
def setSiteLatGrids(self, siteLatGrids):
self.siteLatGrids = siteLatGrids
def getSiteLonGrids(self):
return self.siteLonGrids
def setSiteLonGrids(self, siteLonGrids):
self.siteLonGrids = siteLonGrids

View file

@ -0,0 +1,59 @@
##
# 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
# and then modified post-generation to use AbstractResponseData.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/04/13 #2023 dgilling Initial Creation.
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData
class GridResponseData(AbstractResponseData):
def __init__(self):
super(GridResponseData, self).__init__()
self.parameter = None
self.unit = None
self.gridData = None
def getParameter(self):
return self.parameter
def setParameter(self, parameter):
self.parameter = parameter
def getUnit(self):
return self.unit
def setUnit(self, unit):
self.unit = unit
def getGridData(self):
return self.gridData
def setGridData(self, gridData):
self.gridData = gridData

View file

@ -0,0 +1,36 @@
##
# 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__ = [
'AbstractResponseData',
'GeometryResponseData',
'GetGeometryDataResponse',
'GetGridDataResponse',
'GridResponseData'
]
from AbstractResponseData import AbstractResponseData
from GeometryResponseData import GeometryResponseData
from GetGeometryDataResponse import GetGeometryDataResponse
from GetGridDataResponse import GetGridDataResponse
from GridResponseData import GridResponseData

View file

@ -24,6 +24,7 @@ __all__ = [
'gfe',
'grib',
'grid',
'level',
'message'
]

View file

@ -0,0 +1,90 @@
##
# 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
# and then modified post-generation to add additional features to better
# match Java implementation.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation.
#
#
import numpy
import re
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import MasterLevel
LEVEL_NAMING_REGEX = re.compile("(\d*)((_(\d*))??([a-zA-Z]+))")
INVALID_VALUE = numpy.float64(-999999)
class Level(object):
def __init__(self, levelString=None):
self.id = 0L
self.identifier = None
self.masterLevel = None
self.levelonevalue = INVALID_VALUE
self.leveltwovalue = INVALID_VALUE
if levelString is not None:
matcher = LEVEL_NAMING_REGEX.match(str(levelString))
if matcher is not None:
self.levelonevalue = numpy.float64(matcher.group(1))
self.masterLevel = MasterLevel.MasterLevel(matcher.group(5))
levelTwo = matcher.group(4)
if levelTwo:
self.leveltwovalue = numpy.float64(levelTwo)
def getId(self):
return self.id
def setId(self, id):
self.id = id
def getMasterLevel(self):
return self.masterLevel
def setMasterLevel(self, masterLevel):
self.masterLevel = masterLevel
def getLevelonevalue(self):
return self.levelonevalue
def setLevelonevalue(self, levelonevalue):
self.levelonevalue = numpy.float64(levelonevalue)
def getLeveltwovalue(self):
return self.leveltwovalue
def setLeveltwovalue(self, leveltwovalue):
self.leveltwovalue = numpy.float64(leveltwovalue)
def getIdentifier(self):
return self.identifier
def setIdentifier(self, identifier):
self.identifier = identifier

View file

@ -0,0 +1,71 @@
##
# 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
# and then modified post-generation to add additional features to better
# match Java implementation.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation.
#
#
class MasterLevel(object):
def __init__(self, name=None):
self.name = name
self.description = None
self.unitString = None
self.type = None
self.identifier = None
def getName(self):
return self.name
def setName(self, name):
self.name = name
def getDescription(self):
return self.description
def setDescription(self, description):
self.description = description
def getUnitString(self):
return self.unitString
def setUnitString(self, unitString):
self.unitString = unitString
def getType(self):
return self.type
def setType(self, type):
self.type = type
def getIdentifier(self):
return self.identifier
def setIdentifier(self, identifier):
self.identifier = identifier

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__ = [
'Level',
'MasterLevel'
]
from Level import Level
from MasterLevel import MasterLevel

View file

@ -19,11 +19,23 @@
##
# File auto-generated against equivalent DynamicSerialize Java class
# and then modified post-generation to add additional features to better
# match Java implementation.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# ??/??/?? xxxxxxxx Initial Creation.
# 05/28/13 2023 dgilling Implement __str__().
#
#
import calendar
import datetime
import numpy
import time
import StringIO
from dynamicserialize.dstypes.java.util import Date
from dynamicserialize.dstypes.java.util import EnumSet
@ -39,10 +51,7 @@ class DataTime(object):
ValueError("Invalid validPeriod object specified for DataTime.")
self.validPeriod = validPeriod if validPeriod is not None else None
self.utilityFlags = EnumSet('com.raytheon.uf.common.time.DataTime$FLAG')
# Only way to get a Double type to Java is to use numpy.float64 type,
# which means we need to create an array to hold this single Double value.
# FIXME: Find a better way to store doubles
self.levelValue = numpy.array([-1.0], dtype=numpy.float64)
self.levelValue = numpy.float64(-1.0)
if self.refTime is not None:
if isinstance(self.refTime, datetime.datetime):
@ -62,11 +71,42 @@ class DataTime(object):
self.validPeriod.setEnd(validTimeMills/1000)
# figure out utility flags
if fcstTime is not None:
if fcstTime:
self.utilityFlags.add("FCST_USED")
if self.validPeriod.getStart() != self.validPeriod.getEnd():
if self.validPeriod and self.validPeriod.isValid():
self.utilityFlags.add("PERIOD_USED")
def __str__(self):
buffer = StringIO.StringIO()
if self.refTime is not None:
refTimeInSecs = self.refTime.getTime() / 1000
dtObj = datetime.datetime.utcfromtimestamp(refTimeInSecs)
buffer.write(dtObj.isoformat(' '))
if "FCST_USED" in self.utilityFlags:
hrs = int(self.fcstTime / 3600)
mins = int((self.fcstTime - (hrs * 3600)) / 60)
buffer.write(" (" + str(hrs))
if mins != 0:
buffer.write(":" + str(mins))
buffer.write(")")
if "PERIOD_USED" in self.utilityFlags:
buffer.write("[")
startTimeInSecs = self.validPeriod.getStartInMillis() / 1000
dtObj = datetime.datetime.utcfromtimestamp(startTimeInSecs)
buffer.write(dtObj.isoformat(' '))
buffer.write("--")
endTimeInSecs = self.validPeriod.getEndInMillis() / 1000
dtObj = datetime.datetime.utcfromtimestamp(endTimeInSecs)
buffer.write(dtObj.isoformat(' '))
buffer.write("]")
strVal = buffer.getvalue()
buffer.close()
return strVal
def getRefTime(self):
return self.refTime
@ -92,8 +132,8 @@ class DataTime(object):
self.utilityFlags = utilityFlags
def getLevelValue(self):
return self.levelValue[0]
return self.levelValue
def setLevelValue(self, levelValue):
self.levelValue[0] = levelValue
self.levelValue = numpy.float64(levelValue)

View file

@ -0,0 +1,68 @@
##
# 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.
##
# This class is a dummy implementation of the
# com.vividsolutions.jts.geom.Envelope class. It was simply created to allow
# serialization/deserialization of IDataRequest objects from the Data Access
# Framework. This should be re-implemented if useful work needs to be
# performed against serialized Envelope objects.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation.
#
#
class Envelope(object):
def __init__(self, env=None):
self.maxx = -1.0
self.maxy = -1.0
self.minx = 0.0
self.miny = 0.0
if env is not None:
(self.minx, self.miny, self.maxx, self.maxy) = env.bounds
def getMaxX(self):
return self.maxx
def getMaxY(self):
return self.maxy
def getMinX(self):
return self.minx
def getMinY(self):
return self.miny
def setMaxX(self, value):
self.maxx = value
def setMaxY(self, value):
self.maxy = value
def setMinX(self, value):
self.minx = value
def setMinY(self, value):
self.miny = value

View file

@ -22,9 +22,11 @@
__all__ = [
'Coordinate',
'Envelope',
'Geometry'
]
from Coordinate import Coordinate
from Envelope import Envelope
from Geometry import Geometry

View file

@ -30,21 +30,28 @@
# 12/10/12 njensen Initial Creation.
# Feb 14, 2013 1614 bsteffen refactor data access framework
# to use single request.
# 4/10/13 1871 mnash move getLatLonCoords to JGridData and add default args
# 04/10/13 1871 mnash move getLatLonCoords to JGridData and add default args
# 05/29/13 2023 dgilling Hook up ThriftClientRouter.
#
#
#
import sys
import subprocess
if sys.modules.has_key('jep'):
THRIFT_HOST = subprocess.check_output(
"source /awips2/fxa/bin/setup.env; echo $DEFAULT_HOST",
shell=True).strip()
USING_NATIVE_THRIFT = False
try:
import JepRouter
router = JepRouter
else:
# router = ThriftClientRouter()
import exceptions
raise exceptions.NotImplementedError("Must use inside a JVM until ThriftClient support is added")
except ImportError:
from ufpy.dataaccess import ThriftClientRouter
router = ThriftClientRouter.ThriftClientRouter(THRIFT_HOST)
USING_NATIVE_THRIFT = True
def getAvailableTimes(request):
@ -113,5 +120,16 @@ def newDataRequest():
"""
return router.newDataRequest()
def changeEDEXHost(newHostName):
""""
Changes the EDEX host the Data Access Framework is communicating with. Only
works if using the native Python client implemenation, otherwise, this
method will throw a TypeError.
"""
if USING_NATIVE_THRIFT:
global THRIFT_HOST
THRIFT_HOST = newHostName
global router
router = ThriftClientRouter.ThriftClientRouter(THRIFT_HOST)
else:
raise TypeError("Cannot call changeEDEXHost when using JepRouter.")

View file

@ -0,0 +1,57 @@
##
# 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.
##
#
# Implements IData for use by native Python clients to the Data Access
# Framework.
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/03/13 dgilling Initial Creation.
#
#
from ufpy.dataaccess import IData
class PyData(IData):
def __init__(self, dataRecord):
self.__time = dataRecord.getTime()
self.__level = dataRecord.getLevel()
self.__locationName = dataRecord.getLocationName()
self.__attributes = dataRecord.getAttributes()
def getAttribute(self, key):
return self.__attributes[key]
def getAttributes(self):
return self.__attributes.keys()
def getDataTime(self):
return self.__time
def getLevel(self):
return self.__level
def getLocationName(self):
return self.__locationName

View file

@ -0,0 +1,77 @@
##
# 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.
##
#
# Implements IGeometryData for use by native Python clients to the Data Access
# Framework.
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/03/13 dgilling Initial Creation.
#
#
from ufpy.dataaccess import IGeometryData
from ufpy.dataaccess import PyData
import shapely.wkt
class PyGeometryData(IGeometryData, PyData.PyData):
def __init__(self, geoDataRecord):
PyData.PyData.__init__(self, geoDataRecord)
self.__geometry = shapely.wkt.loads(geoDataRecord.getGeometry())
self.__dataMap = {}
tempDataMap = geoDataRecord.getDataMap()
for key, value in tempDataMap.items():
self.__dataMap[key] = (value[0], value[1], value[2])
def getGeometry(self):
return self.__geometry
def getParameters(self):
return self.__dataMap.keys()
def getString(self, param):
value = self.__dataMap[param][0]
return str(value)
def getNumber(self, param):
value = self.__dataMap[param][0]
t = self.getType(param)
if t == 'INT':
return int(value)
elif t == 'LONG':
return long(value)
elif t == 'FLOAT':
return float(value)
elif t == 'DOUBLE':
return float(value)
else:
return value
def getUnit(self, param):
return self.__dataMap[param][2]
def getType(self, param):
return self.__dataMap[param][1]

View file

@ -0,0 +1,72 @@
# #
# 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.
# #
#
# Implements IGridData for use by native Python clients to the Data Access
# Framework.
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/03/13 #2023 dgilling Initial Creation.
#
#
import numpy
import warnings
from ufpy.dataaccess import IGridData
from ufpy.dataaccess import PyData
NO_UNIT_CONVERT_WARNING = """
The ability to unit convert grid data is not currently available in this version of the Data Access Framework.
"""
class PyGridData(IGridData, PyData.PyData):
def __init__(self, gridDataRecord, nx, ny, latLonGrid):
PyData.PyData.__init__(self, gridDataRecord)
nx = nx
ny = ny
self.__parameter = gridDataRecord.getParameter()
self.__unit = gridDataRecord.getUnit()
self.__gridData = numpy.reshape(numpy.array(gridDataRecord.getGridData()), (nx, ny))
self.__latLonGrid = latLonGrid
def getParameter(self):
return self.__parameter
def getUnit(self):
return self.__unit
def getRawData(self, unit=None):
# TODO: Find a proper python library that deals will with numpy and
# javax.measure style unit strings and hook it in to this method to
# allow end-users to perform unit conversion for grid data.
if unit is not None:
warnings.warn(NO_UNIT_CONVERT_WARNING, stacklevel=2)
return self.__gridData
def getLatLonCoords(self):
return self.__latLonGrid

View file

@ -0,0 +1,113 @@
# #
# 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.
# #
#
# Routes requests to the Data Access Framework through Python Thrift.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/21/13 #2023 dgilling Initial Creation.
#
import numpy
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.impl import DefaultDataRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetAvailableLocationNamesRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetAvailableTimesRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetGeometryDataRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetGridDataRequest
from ufpy import ThriftClient
from ufpy.dataaccess import PyGeometryData
from ufpy.dataaccess import PyGridData
class ThriftClientRouter(object):
def __init__(self, host='localhost'):
self._client = ThriftClient.ThriftClient(host)
def getAvailableTimes(self, request):
timesRequest = GetAvailableTimesRequest()
timesRequest.setRequestParameters(request)
response = self._client.sendRequest(timesRequest)
return response
def getGridData(self, request, times):
gridDataRequest = GetGridDataRequest()
gridDataRequest.setRequestParameters(request)
# if we have an iterable times instance, then the user must have asked
# for grid data with the List of DataTime objects
# else, we assume it was a single TimeRange that was meant for the
# request
try:
iter(times)
gridDataRequest.setRequestedTimes(times)
except TypeError:
gridDataRequest.setRequestedPeriod(times)
response = self._client.sendRequest(gridDataRequest)
locSpecificData = {}
locNames = response.getSiteNxValues().keys()
for location in locNames:
nx = response.getSiteNxValues()[location]
ny = response.getSiteNyValues()[location]
latData = numpy.reshape(numpy.array(response.getSiteLatGrids()[location]), (nx, ny))
lonData = numpy.reshape(numpy.array(response.getSiteLonGrids()[location]), (nx, ny))
locSpecificData[location] = (nx, ny, (lonData, latData))
retVal = []
for gridDataRecord in response.getGridData():
locationName = gridDataRecord.getLocationName()
locData = locSpecificData[locationName]
retVal.append(PyGridData.PyGridData(gridDataRecord, locData[0], locData[1], locData[2]))
return retVal
def getGeometryData(self, request, times):
geoDataRequest = GetGeometryDataRequest()
geoDataRequest.setRequestParameters(request)
# if we have an iterable times instance, then the user must have asked
# for geometry data with the List of DataTime objects
# else, we assume it was a single TimeRange that was meant for the
# request
try:
iter(times)
geoDataRequest.setRequestedTimes(times)
except TypeError:
geoDataRequest.setRequestedPeriod(times)
response = self._client.sendRequest(geoDataRequest)
retVal = []
for geoDataRecord in response.getGeoData():
retVal.append(PyGeometryData.PyGeometryData(geoDataRecord))
return retVal
def getAvailableLocationNames(self, request):
locNamesRequest = GetAvailableLocationNamesRequest()
locNamesRequest.setRequestParameters(request)
response = self._client.sendRequest(locNamesRequest)
return response
def newDataRequest(self):
return DefaultDataRequest()

View file

@ -31,7 +31,8 @@
# Feb 14, 2013 1614 bsteffen refactor data access framework
# to use single request.
# Apr 09, 2013 1871 njensen Add doc strings
#
# Jun 03, 2013 2023 dgilling Add getAttributes to IData, add
# getLatLonGrids() to IGridData.
#
#
@ -182,6 +183,16 @@ class IData(object):
"""
return
@abc.abstractmethod
def getAttributes(self):
"""
Gets the valid attributes for the data.
Returns:
a list of strings of the attribute names
"""
return
@abc.abstractmethod
def getDataTime(self):
"""
@ -250,6 +261,17 @@ class IGridData(IData):
"""
return
@abc.abstractmethod
def getLatLonCoords(self):
"""
Gets the lat/lon coordinates of the grid data.
Returns:
a tuple where the first element is a numpy array of lons, and the
second element is a numpy array of lats
"""
return
class IGeometryData(IData):