Skip to content

Conversation

@erikpelgrim
Copy link
Contributor

Implementation of calculating Kalman Gain for stations with missing observations.

In the document below the developments are explained with mathematical background and references to the code:

SSKF_compensate_for_missing_observations.docx

erikpelgrim and others added 27 commits October 31, 2023 16:52
…g observations, take offset into account, add logging and improve code
…value for missing observations in Steady State filtering
…value for missing observations in Steady State filtering, move code to separate inner class
…ovation value for missing observations in Steady State filtering, move code to separate inner class"

This reverts commit 896c649.
…value for missing observations in Steady State filtering, move code to separate inner class
…value for missing observations in Steady State filtering, move code to separate inner class
…rage

# Conflicts:
#	core/java/src/org/openda/utils/io/KalmanGainStorage.java
#	core/java/test/org/openda/utils/io/KalmanGainStorageTest.java
…FromKalmanGainStorage

# Conflicts:
#	algorithms/java/src/org/openda/algorithms/kalmanFilter/EnKF.java
#	core/java/src/org/openda/blackbox/wrapper/BBStochModelInstance.java
#	core/java/src/org/openda/interfaces/IModelInstance.java
Copy link
Member

@nilsvanvelzen nilsvanvelzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please squash you PR first because

  1. we do not want to have all these commits in main
  2. it makes reviewing very difficult

for(int i=0;i<m;i++){
ArrayList<Integer> missingObservationIndices = new ArrayList<>();
ArrayList<Integer> availableObservationIndices = new ArrayList<>();
for (int i = 0; i < gainStorageObservationIdsArray.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mentioned that documentation will be part of the repository. I suggest to briefly explain what is going on + a link to the detailed description in the document.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

// find matching column in steady-state gain
String gainVectorId = obsIds[i]+":"+Math.round(obsTimeOffsets[i]*24.0*3600.0); //conversion to seconds
Results.putProgression("processing obs "+gainVectorId+"\n");
String gainVectorId = obsIds[i] + ":" + Math.round(obsTimeOffsets[i] * 24.0 * 3600.0); //conversion to seconds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was part of the old code as well. But it puzzles me a bit what this stuff with conversion to seconds is here. You could add a line of comment to explain what kind of ID we are going to construct.

private double[] readGainTime;
private int steadyStateTimeCounter = 0;
private double skipAssimilationStandardDeviationFactor = Double.POSITIVE_INFINITY;
private boolean tryCompensatingForMissingObservationWithHK = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a long name :-) What is HK in this context? H observation interpolation and K the gain? Not clear to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask Julius and Martin if they can give me a better description of HK for inspiration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: estimateMissingObservation

</xs:element>
<xs:element name="tryCompensatingForMissingObservationWithHK" type="xs:boolean" minOccurs="0">
<xs:annotation>
<xs:documentation>When this option is true AND in the kalman gain storage HK has been stored, for locations with missing observations the innovation value </xs:documentation>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again that "HK" is too cryptical for me (might find the answer later)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask Julius and Martin if they can give me a better description of HK for inspiration

@erikpelgrim
Copy link
Contributor Author

I'm having difficulties squashing commits, I'll create a new branch and PR to see if that will resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants