nansencenter / DAPPER

Data Assimilation with Python: a Package for Experimental Research
https://nansencenter.github.io/DAPPER
MIT License
341 stars 119 forks source link

QG Model Observation Vector / State Vector Relative Indexing #94

Closed cgrudz closed 2 years ago

cgrudz commented 2 years ago

I'm working on a simulation built around the idea of the demo.py in the QG model where I'd like to visualize the time series of the truth twin and the associated observations of the truth twin from Sakov2008, plotted side-by-side on the same relative state vector 2D grid. Extracting the relative indices during run-time in the HMM.simulate seems like a reasonable approach, as these indices are defined with a random offset. However, before I do anything too invasive I wanted to check about the proposed approach. The end goal is just to get an intuitive visualization of the truth-twin and the noisy, limited observations of the truth twin as the observation operator sweeps the 2D grid in real time, to better understand both processes.

patnr commented 2 years ago

Not sure I understand. You want to visualize the time series of the obs or a given part of the state? Or how would you plot the whole state together with scalar time series of obs? As for the indices of the obs, I think you might be able to get them directly from dapper/mods/QG/sakov2008.py by duplicating or extracting the mechanism generating them. Not sure if it helps, hope so.

cgrudz commented 2 years ago

I'm thinking of a side-by-side plot where the observation vector is plotted on the same 2D grid as is done with \psi and q in demo.py. In this sense, I would want to create a vector with dummy NaN values for unobserved positions while the observed indices are filled with the observation vector. I think that could work, as you say, just replicating the index process, thought the seed management might be difficult as the random offset would be affected by the observation noise realizations.

cgrudz commented 2 years ago

The plot I'd like would be left-hand-side, \psi, right-hand-side, \mathbb{H}\psi + noise, on the same parent 2D grid of the state vector plot.

patnr commented 2 years ago

So like this ?

patnr commented 2 years ago

I guess you could from dapper.mods.QG.sakov2008 import obs_inds, right?

patnr commented 2 years ago

Make sure you're also able to try examples/basic_1.py with from dapper.mods.QG.sakov2008 import HMM with liveplotting just to get a sense of the satellite tracks.

cgrudz commented 2 years ago

Yeah the visualization in the video is the right sort of idea -- I want to make a demonstration of the observation generating process and the observations themselves to show relative sparsity / noise in the observation retrieval for the HMM, without necessarily performing an actual DA experiment. basic_1.py worked well with the from dapper.mods.QG.sakov2008 import HMM , this is also very nice demonstration of the model. I missed this

rstream.seed(int(t/model.prms['dtout']*100))

earlier in my inspection -- this says that the random offset is handled with a separate time-dependent seeding so the positions are reproducible from obs_inds(t) alone then?

patnr commented 2 years ago

so the positions are reproducible from obs_inds(t)alone then

Yes

Seems like you're on the right path with the PR so I'll close this discussion.