public IVector[] GetObservedLocalization(IObservationDescriptions observationDescriptions, double distance)
        {
            /* Return identity localization */
            // Console.Out.WriteLine("Return identity localization");
            int     nObs   = observationDescriptions.ObservationCount;
            IVector locvec = new VectorJ2N(state.Size);

            IVector[] result = new IVector[nObs];

            for (int iObs = 0; iObs < nObs; iObs++)
            {
                locvec.SetConstant(1.0);
                result[iObs] = locvec;
            }
            return(result);
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
 public IVector[] GetObservedLocalization(String exchageItemID, IObservationDescriptions observationDescriptions, double distance)
 {
     return(null);
 }
Beispiel #5
0
 public IVector GetObservedValues(IObservationDescriptions observationDescriptions)
 {
     return(null);
 }
Beispiel #6
0
 public IVector[] GetObservedLocalization(IObservationDescriptions observationDescriptions, double distance)
 {
     return(null);
 }
        public IVector GetObservedValues(IObservationDescriptions descr)
        {
            IVector result = new VectorJ2N(descr.ObservationCount);

            // TODO: handle TimeSeriesObservationDescriptions
            IVector obsTimes = descr.GetValueProperties("time");

            IVector obsIndex = descr.GetValueProperties("index") ?? descr.GetValueProperties("xPosition");

            IVector transformIndex;

            try
            {
                transformIndex = descr.GetValueProperties("transform");
            }
            catch (Exception)
            {
                transformIndex = null;
            }

            Time tHor = new Time(parameterValues[StartTimeId],
                                 parameterValues[StopTimeId])
            ;

            tHor.StepMJD = parameterValues[TimeStepId];

            if (storeObs)
            {
                //work from stored states
                for (int i = 0; i < descr.ObservationCount; i++)
                {
                    // at which timestep is this obs
                    long iObs = Utils.GetTimeStep(tHor, (new Time(obsTimes.GetValue(i))));
                    // find corresponding storage location
                    int thisTIndex = iStore.IndexOf((int)iObs);                      //time index in storage
                    if (thisTIndex < 0)
                    {
                        throw (new Exception("model.getValues: time out of range for observation nr. " + i));
                    }
                    int thisXIndex = (int)obsIndex.GetValue(i);
                    if ((thisXIndex < 0) | (thisXIndex >= state.Size))
                    {
                        throw (new Exception("model.getValues: index out of range for "
                                             + " observation nr. " + i
                                             + " index= " + thisXIndex));
                    }
                    //Console.Out.WriteLine("i="+i+" it="+thisTIndex+" ind= "+thisXIndex);
                    double thisValue = xStore[thisTIndex].GetValue(thisXIndex);
                    // transform values if needed
                    if (transformIndex != null)
                    {
                        if (transformIndex.GetValue(i) == 2)
                        {
                            // magic number for quadratic observations
                            thisValue = thisValue * thisValue;
                        }
                    }
                    result.SetValue(i, thisValue);
                }
            }
            else
            {
                // only current state is available
                for (int i = 0; i < descr.ObservationCount; i++)
                {
                    int thisXIndex = (int)obsIndex.GetValue(i);
                    //TODO if(){ //check time
                    double thisValue = state.GetValue(thisXIndex);
                    // transform values if needed
                    if (transformIndex != null)
                    {
                        if (transformIndex.GetValue(i) == 2)
                        {
                            // magic number for quadratic observations
                            thisValue = thisValue * thisValue;
                        }
                    }
                    result.SetValue(i, thisValue);
                }
            }

            return(result);
        }