Skip to content

Ndbc oot #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
df54d06
Updated addons to use new SWE constants and helpers
alexrobin Jun 2, 2020
633fe2b
Intellisense (#13)
TheRestOfMe Jun 3, 2020
7e03243
Gage fix2 (#17)
TheRestOfMe Jun 3, 2020
e6ddd18
Merge branch 'master' of https://github.com/opensensorhub/osh-addons.git
alexrobin Jun 3, 2020
89d2649
Changes to refactoring of addIdentifier2() to addIdentifier()
alexrobin Jun 3, 2020
64fda30
Added trajectory caching and an apiTimePeriod to allow reduction of c…
Jun 5, 2020
f011c6f
Added trajectory caching and an apiTimePeriod to allow reduction of c…
TheRestOfMe Jun 6, 2020
398197e
Added simple logic to auto-detect component containing encoded video
alexrobin Jun 12, 2020
b24c7e3
Added video transcoder based on FFMPEG bytedeco bindings
alexrobin Jun 14, 2020
8da8d30
Added support for scale + clone datablock to avoid interference w/
alexrobin Jun 14, 2020
be6d0be
Cleaned up some code- switched to Java8 time classes;time=now request…
Jul 30, 2020
8fcab4c
Archived Requests working; but data is pulled from NDBC, even if it i…
Jul 30, 2020
9c2c544
Rewriting parser
Jul 31, 2020
c9cca26
Adding to BuoyParser and testing
Aug 1, 2020
3c3049b
Swapping out RecordLoader with new Loader/Parser
Aug 3, 2020
88942b0
Creating separate outputs for each param; driver rewrite
Aug 5, 2020
a789ca7
Continued refactoring of Buoy driver
Aug 6, 2020
bc16095
sea_water_tempearture works. More refactoring.
Aug 6, 2020
8a764d5
Fixed time range on NDBC requests
Aug 6, 2020
5611f42
Conntinued refactor of Driver
Aug 10, 2020
cf044cd
Cleaned up lots of code. Latest and archvie requests working for a si…
Aug 11, 2020
f5d236b
Added support for transcoding HEVC, VP8 and VP9
alexrobin Aug 19, 2020
6f13cc3
Added Bouy ID and MOMSN to GPS LLA Output
drewbotts Aug 19, 2020
3f0851c
Always round frame dimensions to closest multiple of 2 + improved
alexrobin Aug 20, 2020
62bd5a9
Added cleanup code to prevent memory leak of internal FFPEG objects
alexrobin Aug 21, 2020
29c2978
Restored original 'empty-sost- config
alexrobin Aug 22, 2020
1a01daf
Remove .deleted storage files
alexrobin Aug 22, 2020
ccf4d86
Added video transcoding test config
alexrobin Aug 22, 2020
717414a
Merge remote-tracking branch 'origin/fakeGps-googleApiLimit'
alexrobin Sep 7, 2020
efe84a0
Bump netty.version in /services/sensorhub-service-mqtt (#14)
dependabot[bot] Sep 7, 2020
1e6dfb7
Bump org.eclipse.paho.client.mqttv3 in /services/sensorhub-service-mq…
dependabot[bot] Sep 7, 2020
609b6aa
Bump netty.version in /services/sensorhub-service-mqtt (#24)
dependabot[bot] Sep 7, 2020
047ddf9
Add support for getFoiTimeRanges
alexrobin Sep 7, 2020
016904f
Merge FOI Time Range updates into my ndbc-oot branch
Sep 7, 2020
2ef7bc1
Remove deprecated NDBCArchiveOld
Sep 9, 2020
33b37b7
Added Caps parsing for FOI Time Ranges; added some config params
Sep 10, 2020
77f2df9
Adding outputs; fix message URNs
Sep 14, 2020
96d135d
Added implementations of new updateRecordStore() method
alexrobin Sep 20, 2020
4be180d
Fixing CapsReader timer class to pass information back to NDBCArchive…
Sep 22, 2020
fa2bd89
Remove deprecated class
Sep 22, 2020
8a219ee
Merge branch 'master' into ndbc-oot
alexrobin Sep 22, 2020
962708b
Remove deprecated classes
Sep 22, 2020
c4a236d
Added GPSOutput; Fixed several outstanding issues
Sep 22, 2020
ce4fc7d
Fix time=now request to return only a single latetst record
Sep 22, 2020
32218a6
Added Header block to all classes
Sep 22, 2020
5ed3c98
Fix Unit test failure
Sep 22, 2020
807df17
Merge branch 'master' into ndbc-oot
Sep 22, 2020
02333c6
Merge branch 'ndbc-oot' of https://github.com/opensensorhub/osh-addon…
Sep 22, 2020
2dea385
Updated README
Sep 22, 2020
35c85cb
Workaround for NDBC SOS issues with handling &eventTime=latest requests
Sep 24, 2020
1dfdde1
Merge pull request #25 from drewbotts/float-gps
drewbotts Sep 24, 2020
12dbcc3
Added Outputs; Fix some definition URNs
Sep 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
**/.classpath
**/.idea
**/*.iml
**/*.deleted
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ public void addRecordStore(String name, DataComponent recordStructure, DataEncod
// do nothing
}

@Override
public void updateRecordStore(String name, DataComponent recordStructure)
{
// TODO implement updating the record description
}

@Override
public int getNumRecords(String recordType) {
SearchResponse response = client.prepareSearch(indexName).setTypes(RS_DATA_IDX_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.sensorhub.api.persistence.IObsStorageModule;
import org.sensorhub.api.persistence.ObsFilter;
import org.sensorhub.api.persistence.ObsKey;
import org.sensorhub.api.persistence.ObsPeriod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vast.ogc.gml.GMLUtils;
Expand Down Expand Up @@ -917,4 +918,11 @@ protected synchronized QueryBuilder getPolygonGeoQuery(Polygon polygon) throws I
return QueryBuilders.geoIntersectionQuery(SHAPE_FIELD_NAME,
ShapeBuilders.newPolygon(Arrays.asList(polygon.getCoordinates())));
}

@Override
public Iterator<ObsPeriod> getFoiTimeRanges(IObsFilter filter) {
// TODO implement getFoiTimeRanges()
ObsPeriod unknownPeriod = new ObsPeriod("NONE", Double.NaN, Double.NaN);
return Arrays.asList(unknownPeriod).iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import org.sensorhub.api.persistence.IDataRecord;
import org.sensorhub.api.persistence.IFoiFilter;
import org.sensorhub.api.persistence.IMultiSourceStorage;
import org.sensorhub.api.persistence.IObsFilter;
import org.sensorhub.api.persistence.IObsStorage;
import org.sensorhub.api.persistence.ObsPeriod;
import org.vast.util.Asserts;
import org.vast.util.Bbox;
import net.opengis.gml.v32.AbstractFeature;
Expand Down Expand Up @@ -490,6 +492,36 @@ public Iterator<AbstractFeature> getFois(final IFoiFilter filter)

return fois.iterator();
}


@Override
public Iterator<ObsPeriod> getFoiTimeRanges(IObsFilter filter)
{
return new Iterator<ObsPeriod>() {
Iterator<MVObsStorageImpl> dataStoresIt = obsStores.values().iterator();
Iterator<ObsPeriod> currentIterator;

@Override
public boolean hasNext()
{
while (currentIterator == null || !currentIterator.hasNext())
{
if (!dataStoresIt.hasNext())
return false;

currentIterator = dataStoresIt.next().getFoiTimeRanges(filter);
}

return true;
}

@Override
public ObsPeriod next()
{
return currentIterator.next();
}
};
}


@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@
import org.sensorhub.api.persistence.IDataFilter;
import org.sensorhub.api.persistence.IDataRecord;
import org.sensorhub.api.persistence.IFoiFilter;
import org.sensorhub.api.persistence.IObsFilter;
import org.sensorhub.api.persistence.IObsStorageModule;
import org.sensorhub.api.persistence.IRecordStoreInfo;
import org.sensorhub.api.persistence.IStorageModule;
import org.sensorhub.api.persistence.ObsPeriod;
import org.sensorhub.api.persistence.StorageException;
import org.sensorhub.impl.module.AbstractModule;
import org.sensorhub.utils.DataComponentChecks;
import org.sensorhub.utils.FileUtils;
import org.vast.util.Asserts;
import org.vast.util.Bbox;
Expand Down Expand Up @@ -157,12 +160,7 @@ public synchronized void start() throws SensorHubException

private void loadRecordStore(IRecordStoreInfo rsInfo)
{
MVTimeSeriesImpl recordStore;
if (config.indexObsLocation)
recordStore = new MVTimeSeriesImpl(this, rsInfo);
else
recordStore = new MVTimeSeriesImpl(this, rsInfo.getName());

MVTimeSeriesImpl recordStore = new MVTimeSeriesImpl(this, rsInfo, config.indexObsLocation);
recordStores.put(rsInfo.getName(), recordStore);
}

Expand Down Expand Up @@ -398,6 +396,27 @@ public synchronized void addRecordStore(String name, DataComponent recordStructu
rsInfoMap.put(name, rsInfo);
loadRecordStore(rsInfo);
}


@Override
public void updateRecordStore(String name, DataComponent newDataStruct)
{
checkOpen();
Asserts.checkNotNull(name, "name");
Asserts.checkNotNull(newDataStruct, DataComponent.class);

DataStreamInfo oldRsInfo = (DataStreamInfo)rsInfoMap.get(name);
if (oldRsInfo == null)
throw new IllegalArgumentException("No time series with name " + name);

// check that new structure is compatible with previous one
if (!DataComponentChecks.checkStructCompatible(oldRsInfo.recordDescription, newDataStruct))
throw new IllegalStateException("New data structure for record store " + getName() +
" is not compatible with the one already in storage");

DataStreamInfo newRsInfo = new DataStreamInfo(name, newDataStruct, oldRsInfo.recommendedEncoding);
rsInfoMap.put(name, newRsInfo);
}


public synchronized void upgradeRecordStore(String name, DataComponent recordStructure, DataEncoding recommendedEncoding, boolean deleteRecords)
Expand Down Expand Up @@ -650,6 +669,36 @@ public Iterator<AbstractFeature> getFois(IFoiFilter filter)
}


@Override
public Iterator<ObsPeriod> getFoiTimeRanges(IObsFilter filter)
{
checkOpen();
filter = (IObsFilter)ensureProducerID(filter);

MVTimeSeriesImpl recordStore = getRecordStore(filter.getRecordType());
Set<ObsTimePeriod> timePeriods = recordStore.getObsTimePeriods(producerID, filter, true);
if (timePeriods == null)
return Collections.emptyIterator();

Iterator<ObsTimePeriod> it = timePeriods.iterator();
return new Iterator<ObsPeriod>() {

@Override
public boolean hasNext()
{
return it.hasNext();
}

@Override
public ObsPeriod next()
{
ObsTimePeriod p = it.next();
return new ObsPeriod(p.foiID, p.start, p.stop);
}
};
}


@Override
public synchronized void storeFoi(String producerID, AbstractFeature foi)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,29 @@ protected IDataRecord process(IDataRecord elt)
}


public MVTimeSeriesImpl(MVObsStorageImpl parentStore, String seriesName)
public MVTimeSeriesImpl(MVObsStorageImpl parentStore, IRecordStoreInfo rsInfo, boolean indexObsLocation)
{
this.name = seriesName;
this.name = rsInfo.getName();
this.parentStore = parentStore;

String mapName = RECORDS_MAP_NAME + ":" + seriesName;
// create maps
String mapName = RECORDS_MAP_NAME + ":" + this.name;
this.recordIndex = parentStore.mvStore.openMap(mapName, new MVMap.Builder<ProducerTimeKey, DataBlock>()
.keyType(new ProducerKeyDataType())
.valueType(new DataBlockDataType()));

this.foiTimesIndex = new MVFoiTimesStoreImpl(parentStore.mvStore, seriesName);
}


public MVTimeSeriesImpl(MVObsStorageImpl parentStore, IRecordStoreInfo rsInfo)
{
this(parentStore, rsInfo.getName());

// try to detect sampling location
VectorIndexer locationIndexer = SWEDataUtils.getLocationIndexer(rsInfo.getRecordDescription());
this.foiTimesIndex = new MVFoiTimesStoreImpl(parentStore.mvStore, this.name);

// if found, also use sampling lolcation index
if (locationIndexer != null)
this.samplingLocationIndex = new MVSamplingLocationIndexImpl(parentStore.mvStore, rsInfo.getName(), locationIndexer);
// prepare to index location if requested
if (indexObsLocation)
{
// try to detect sampling location
VectorIndexer locationIndexer = SWEDataUtils.getLocationIndexer(rsInfo.getRecordDescription());

// if found, also use sampling lolcation index
if (locationIndexer != null)
this.samplingLocationIndex = new MVSamplingLocationIndexImpl(parentStore.mvStore, rsInfo.getName(), locationIndexer);
}
}


Expand Down Expand Up @@ -534,7 +533,7 @@ private Iterator<IDataRecord> getEntryIterator(IDataFilter filter, boolean prelo
String producerID = getProducerID(filter);

// get time periods matching filter
Set<ObsTimePeriod> obsTimePeriods = getObsTimePeriods(producerID, filter);
Set<ObsTimePeriod> obsTimePeriods = getObsTimePeriods(producerID, filter, false);

// return special iterator to scan through each time range sequentially
// optionally post-filtering records on their spatial location
Expand All @@ -545,7 +544,7 @@ private Iterator<IDataRecord> getEntryIterator(IDataFilter filter, boolean prelo
}


private Set<ObsTimePeriod> getObsTimePeriods(String producerID, final IDataFilter filter)
Set<ObsTimePeriod> getObsTimePeriods(String producerID, final IDataFilter filter, boolean returnAllIfNoFoiSelected)
{
double[] timeRange = getTimeRange(producerID, filter);

Expand Down Expand Up @@ -641,9 +640,15 @@ public Polygon getRoi()
obsTimeRanges = samplingTimeRanges;
}

// if no time periods selected, just process whole time range
// if no foi was selected, return either the whole time range
// or the list of all foi time ranges
if (obsTimeRanges == null)
obsTimeRanges = Sets.newHashSet(new ObsTimePeriod(producerID, null, timeRange[0], timeRange[1]));
{
if (returnAllIfNoFoiSelected)
obsTimeRanges = foiTimesIndex.getSortedFoiTimes(producerID, null);
else
obsTimeRanges = Sets.newHashSet(new ObsTimePeriod(producerID, null, timeRange[0], timeRange[1]));
}

// trim periods to time range specified in filter
Iterator<ObsTimePeriod> it = obsTimeRanges.iterator();
Expand All @@ -652,6 +657,9 @@ public Polygon getRoi()
ObsTimePeriod obsTimePeriod = it.next();
if (!trimTimeRange(obsTimePeriod, timeRange[0], timeRange[1]))
it.remove();

if (obsTimePeriod.stop == Double.POSITIVE_INFINITY)
obsTimePeriod.stop = getDataTimeRange(producerID)[1];
}

return obsTimeRanges;
Expand Down
Loading