# Help understanding hofx yaml for creating simulated obs

**URL:** <https://forums.jcsda.org/t/help-understanding-hofx-yaml-for-creating-simulated-obs/526>\
**Category:** JEDI\
**Created:** [September 18, 2023, 5:31pm UTC](https://forums.jcsda.org/t/help-understanding-hofx-yaml-for-creating-simulated-obs/526 "2023-09-18T17:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwharrop](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@cwharrop](https://forums.jcsda.org/u/cwharrop)\
**Post date:** [September 18, 2023, 5:31pm UTC](https://forums.jcsda.org/t/help-understanding-hofx-yaml-for-creating-simulated-obs/526/1 "2023-09-18T17:31:40Z")

</div>

HI,

I am wondering if someone might be able to help verify my understanding of the YAML configuration when generating obs using HofX.

Take this example from the OOPS QG model test input:

```auto
geometry:
  nx: 40
  ny: 20
  depths: [4500.0, 5500.0]
initial condition:
  date: 2010-01-01T00:00:00Z
  filename: Data/truth.fc.2009-12-15T00:00:00Z.P17D.nc
model:
  name: QG
  tstep: PT1H
forecast length: PT15H
window begin: 2010-01-01T00:00:00Z
window length: PT15H
observations:
  observers:
  - obs operator:
      obs type: Stream
    obs space:
      obsdataout:
        engine:
          obsfile: Data/truth.obs3d.nc
      obs type: Stream
      generate:
        begin: PT10H
        nval: 1
        obs density: 100
        obs error: 4.0e6
        obs period: PT1H

```

The part I’m not sure about is the `generate` section, which is not described in the documentation I’ve found so far. I take the above to mean “run a forecast for analysis time `2010-01-01T00:00:00Z` using initial conditions from `Data/truth.fc.2009-12-15T00:00:00Z.P17D.nc` and between 10-11 hours into that forecast generate 100 random observations”. I am wondering if that is correct? I am not 100% sure I’m correctly understanding the meaning of “begin” and “obs period” in the “generate” section. It’s been a long time since I’ve done this, so can’t remember.

---

<div class="post-metadata">

**Author:** ![csampson](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/csampson/32/209_2.png) [@csampson](https://forums.jcsda.org/u/csampson)\
**Post date:** [September 18, 2023, 9:22pm UTC](https://forums.jcsda.org/t/help-understanding-hofx-yaml-for-creating-simulated-obs/526/2 "2023-09-18T21:22:40Z")

</div>

Hello!

In this case the “begin” key defines the first time after the “window begin” date to generate the first observation. So the first observation time would be 2010-01-01T10:00:00Z 10 hours after the window begin date. The “obs period” is actually a frequency with which to take observations until the end of the window. So with the window ending at 2010-01-01T15:00:00Z since the length is PT15H observations would be generated every hour after the begin time until then. So one should get 5 observations if the frequency is PT1H.

For how this set see: [https://github.com/JCSDA-internal/oops/blob/f09288bc017757b3e157fc9be8121ee94754c86b/qg/model/ObsSpaceQG.cc#L92](https://github.com/JCSDA-internal/oops/blob/f09288bc017757b3e157fc9be8121ee94754c86b/qg/model/ObsSpaceQG.cc#L92)

The “obs density” key is used to determine how many locations one wants to have observations at at a given time. When using this key as in this example 100 (x,y,z) locations are chosen according to a random distribution.  
For this set up see: [https://github.com/JCSDA-internal/oops/blob/f09288bc017757b3e157fc9be8121ee94754c86b/qg/model/qg\_obsdb\_mod.F90#L339](https://github.com/JCSDA-internal/oops/blob/f09288bc017757b3e157fc9be8121ee94754c86b/qg/model/qg_obsdb_mod.F90#L339)

So essentially you are correct, just that the obs period tells how often to get obs until the end of the window.
