public IVector[] GetObservedLocalization(IObservationDescriptions observationDescriptions, double distance) { throw new NotImplementedException(); //NOTE OLD STUFF if (_openMIComponent is ITimeSpaceComponentExtensions) { ITimeSpaceComponentExtensions extendedComponent = (ITimeSpaceComponentExtensions)_openMIComponent; //Determine the number of observations (=number of columns) int nObs = observationDescriptions.ObservationCount; org.openda.utils.TreeVector[] retVectorsTree = new org.openda.utils.TreeVector[nObs]; for (int iObs = 0; iObs < nObs; iObs++) { retVectorsTree[iObs] = new org.openda.utils.TreeVector("localizationMask"); } // Loop over all active echangeItems // Note interface of this method must be improved to fix and answer the question which echangeItems are inwhat order in the state vector foreach (KeyValuePair <string, ExchangeItem> inout in _inout) { string exchangeItemID = inout.Key; double[][] mask = extendedComponent.getLocalization(exchangeItemID, observationDescriptions, distance); if (mask != null) { for (int iObs = 0; iObs < nObs; iObs++) { org.openda.utils.Vector vec = new org.openda.utils.Vector(mask[iObs]); org.openda.utils.TreeVector subVec = new org.openda.utils.TreeVector(exchangeItemID, vec); retVectorsTree[iObs].addChild(subVec); } } } // Cast fancy treevectors to vectors IVector[] retVectors = new IVector[nObs]; for (int iObs = 0; iObs < nObs; iObs++) { double[] values = retVectorsTree[iObs].getValues(); retVectors[iObs] = new OpenDA.DotNet.Bridge.Vector(values); } return(retVectors); } else { throw new NotImplementedException(); return(null); } }
/// <summary> /// Get the values from the model corresponding to the observations. /// The first this is called, _listModelIndicesAtObservations will be null so a list must be created. /// </summary> /// <param name="observationDescriptions">The observations.</param> /// <returns>Model values corresponding to observation points.</returns> public IVector GetObservedValues(OpenDA.DotNet.Interfaces.IObservationDescriptions observationDescriptions) { if (_extendedComponent == null && _openMIComponent is ITimeSpaceComponentExtensions) { _extendedComponent = (ITimeSpaceComponentExtensions)_openMIComponent; _listModelIndicesAtObservations = _extendedComponent.CreateModelIndicesHashTable(observationDescriptions); return(new Vector(_extendedComponent.getObservedValues(observationDescriptions))); } else if (_listModelIndicesAtObservations != null) { double[] modelValuesAtIndices = _extendedComponent.ModelValuesAtProvidedIndices(observationDescriptions, _listModelIndicesAtObservations); return(new Vector(modelValuesAtIndices)); } return(null); }
private ITime DetermineCurrentTime(ITime currentTime) { /* In case the component implements some extensions, use them */ if (_openMIComponent is ITimeSpaceComponentExtensions) { ITimeSpaceComponentExtensions extendedComponent = (ITimeSpaceComponentExtensions)_openMIComponent; double now = extendedComponent.currentTime().StampAsModifiedJulianDay; return(new DotNet.Bridge.Time(now)); } /* We have to fall back on a proper time administration in the exhange items */ foreach (KeyValuePair <string, ExchangeItem> output in _outputs) { if (output.Value.Times != null && output.Value.Times.Length > 0) { double timeAsMJD = output.Value.Times[output.Value.Times.Length - 1]; currentTime = new DotNet.Bridge.Time(timeAsMJD); if (currentTime != null) { return(currentTime); } } } foreach (KeyValuePair <string, ExchangeItem> inout in _inout) { if (inout.Value.Times != null && inout.Value.Times.Length > 0) { double timeAsMJD = inout.Value.Times[inout.Value.Times.Length - 1]; currentTime = new DotNet.Bridge.Time(timeAsMJD); break; } break; } if (currentTime == null) { currentTime = TimeHorizon.BeginTime; } return(currentTime); // } }
public IVector[] GetObservedLocalization(String exchangeItemID, IObservationDescriptions observationDescriptions, double distance) { if (_openMIComponent is ITimeSpaceComponentExtensions) { int nObs = observationDescriptions.ObservationCount; IVector[] retVectors = new IVector[nObs]; ITimeSpaceComponentExtensions extendedComponent = (ITimeSpaceComponentExtensions)_openMIComponent; double[][] mask = extendedComponent.getLocalization(exchangeItemID, observationDescriptions, distance); if (mask != null) { for (int iObs = 0; iObs < nObs; iObs++) { retVectors[iObs] = new OpenDA.DotNet.Bridge.Vector(mask[iObs]); } } return(retVectors); } else { throw new NotImplementedException(); return(null); } }