Issue #1257: Update pypies group referencing and enable compression for radar and vil

Change-Id: Ib75b9fec9293f858b638f5eb61140da575909a34

Former-commit-id: 2b22618fa1 [formerly f58dbfeb65] [formerly d40f52a0bc] [formerly d40f52a0bc [formerly f2ac3dc537]] [formerly c2a46e0b35 [formerly d40f52a0bc [formerly f2ac3dc537] [formerly c2a46e0b35 [formerly bbca9f1eb7b3bc568ab3cabc9ad83510afd7317f]]]]
Former-commit-id: c2a46e0b35
Former-commit-id: ffdae690f9dc0e0c916ae577e03188272d947322 [formerly 894b23d3d92172d9e3d25a741714f67203a14c5f] [formerly 67da3874f4 [formerly bb723dc404]]
Former-commit-id: 67da3874f4
Former-commit-id: 89c1a1add4
This commit is contained in:
Richard Peter 2012-10-09 17:21:56 -05:00
parent 2270a2e9d0
commit 695170b00f
4 changed files with 49 additions and 34 deletions

View file

@ -14,6 +14,7 @@
<property name="pathProvider">
<ref bean="radarPathProvider" />
</property>
<property name="compression" value="LZF"/>
</bean>
<bean id="radarRegistered" factory-bean="pluginRegistry"

View file

@ -29,8 +29,10 @@ import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.vil.VILRecord;
import com.raytheon.uf.common.dataplugin.vil.VILRecord.DATA_TYPE;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageProperties;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.database.plugin.PluginDao;
/**
@ -49,51 +51,61 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
*/
public class VILDao extends PluginDao {
public VILDao(String pluginName) throws PluginException {
public VILDao(final String pluginName) throws PluginException {
super(pluginName);
}
@Override
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
protected IDataStore populateDataStore(final IDataStore dataStore,
final IPersistable obj) throws Exception {
VILRecord VILRec = (VILRecord) obj;
if (VILRec.getDataArray() != null
String compression = PluginRegistry.getInstance()
.getRegisteredObject(pluginName).getCompression();
StorageProperties sp = null;
if (compression != null) {
sp = new StorageProperties();
sp.setCompression(StorageProperties.Compression
.valueOf(compression));
}
if ((VILRec.getDataArray() != null)
&& VILRec.getFieldName().equals(DATA_TYPE.VILD.name())) {
IDataRecord rec = new FloatDataRecord("Data", VILRec.getDataURI(),
VILRec.getDataArray(), 2, new long[] { VILRec.getNx(),
VILRec.getNy() });
rec.setCorrelationObject(VILRec);
dataStore.addDataRecord(rec);
dataStore.addDataRecord(rec, sp);
}
if (VILRec.getDataArray() != null
if ((VILRec.getDataArray() != null)
&& VILRec.getFieldName().equals(DATA_TYPE.DVILD.name())) {
IDataRecord rec = new FloatDataRecord("Data", VILRec.getDataURI(),
VILRec.getDataArray(), 2, new long[] { VILRec.getNx(),
VILRec.getNy() });
rec.setCorrelationObject(VILRec);
dataStore.addDataRecord(rec);
dataStore.addDataRecord(rec, sp);
}
if (VILRec.getDataArray() != null
if ((VILRec.getDataArray() != null)
&& VILRec.getFieldName().equals(DATA_TYPE.EDVILD.name())) {
IDataRecord rec = new FloatDataRecord("Data", VILRec.getDataURI(),
VILRec.getDataArray(), 2, new long[] { VILRec.getNx(),
VILRec.getNy() });
rec.setCorrelationObject(VILRec);
dataStore.addDataRecord(rec);
dataStore.addDataRecord(rec, sp);
}
logger.debug("VILDao: writing " + VILRec.toString());
return dataStore;
}
@Override
public List<IDataRecord[]> getHDF5Data(List<PluginDataObject> objects,
int tileSet) throws PluginException {
public List<IDataRecord[]> getHDF5Data(
final List<PluginDataObject> objects, final int tileSet)
throws PluginException {
List<IDataRecord[]> retVal = new ArrayList<IDataRecord[]>();
for (PluginDataObject obj : objects) {
@ -114,4 +126,3 @@ public class VILDao extends PluginDao {
return retVal;
}
}

View file

@ -20,6 +20,7 @@
<value>com.raytheon.uf.common.dataplugin.radar</value>
</list>
</property>
<property name="compression" value="LZF"/>
</bean>
<bean factory-bean="pluginRegistry" factory-method="register" depends-on="radarRegistered">

View file

@ -28,7 +28,8 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/16/10 njensen Initial Creation.
# 05/03/11 9134 njensen Optimized for pointdata
# 05/03/11 9134 njensen Optimized for pointdata
# 10/09/12 rjpeter Optimized __getGroup for retrievals
#
#
#
@ -528,6 +529,7 @@ class H5pyDataStore(IDataStore.IDataStore):
if chunks:
plc.set_chunk(chunks)
if compression == 'LZF':
plc.set_shuffle()
plc.set_filter(h5py.h5z.FILTER_LZF, h5py.h5z.FLAG_OPTIONAL)
szDims = tuple(szDims)
@ -612,28 +614,28 @@ class H5pyDataStore(IDataStore.IDataStore):
def __getGroup(self, f, name, create=False):
t0=time.time()
parts = name.split('/')
grp = None
for s in parts:
if not grp:
if not s:
s = '/'
if s == '/' or s in f.keys():
grp = f[s]
else:
if create:
if create:
parts = name.split('/')
grp = None
for s in parts:
if not grp:
if not s:
s = '/'
if s == '/' or s in f.keys():
grp = f[s]
else:
grp = f.create_group(s)
else:
raise StorageException("No group " + name + " found")
else:
if s:
if s in grp.keys():
grp = grp[s]
else:
if create:
grp = grp.create_group(s)
else:
if s:
if s in grp.keys():
grp = grp[s]
else:
raise StorageException("No group " + name + " found")
grp = grp.create_group(s)
else:
try:
grp = f[name]
except KeyError:
raise StorageException("No group " + name + " found")
t1=time.time()
if timeMap.has_key('getGroup'):