ensembleObservations_mod

link to source code

Dependency Diagrams:

ensembleObservations_mod.svg

Direct Dependency Diagram

ensembleObservations_mod_rev.svg

Reverse Dependency Diagram

Description

MODULE ensembleObservations_mod (prefix=’eob’ category=’6. High-level data objects’)

Purpose

Store and manipulate ensemble of quanitites in observation space. This module uses the kdtree2 module for efficiently finding the nearest observations within the local volume.

Quick access

Types

struct_eob

Variables

eob_simobsassim

Routines

eob_allgather(), eob_allocate(), eob_backgroundcheck(), eob_calcandremovemeanyb(), eob_calcrandpert(), eob_clean(), eob_copy(), eob_deallocate(), eob_getlocalbodyindices(), eob_hubernorm(), eob_init(), eob_readfromfiles(), eob_rejectradnearsfc(), eob_removeobsnearland(), eob_setassflag(), eob_setdeteryb(), eob_sethpht(), eob_setlatlonobs(), eob_setmeanomp(), eob_setobserrinv(), eob_setpsvobserrinv(), eob_setsigisigo(), eob_setsimobserrinv(), eob_setsimobsval(), eob_settypevertcoord(), eob_setvertlocation(), eob_setya(), eob_setyb(), eob_writetofiles(), eob_zero(), get_peak(), getmemberindexinfullensset(), max_transmission()

Needed modules

  • kdtree2_mod: MODULE kdTree2_mod (prefix=’kdtree2’ category=’8. Low-level utilities and constants’)

  • columndata_mod: MODULE columnData_mod (prefix=’col’ category=’6. High-level data objects’)

  • tovsnl_mod: MODULE tovsNL_mod (prefix=’tvs’ category=’5. Observation operators’)

  • rttov_types (rttov_transmission(), rttov_profile())

  • parkind1 (jpim(), jprb())

  • midasmpi_mod: MODULE midasMpi_mod (prefix=’mmpi’ category=’8. Low-level utilities and constants’)

  • oceanmask_mod: MODULE oceanMask_mod (prefix=’ocm’ category=’7. Low-level data objects’)

  • obsspacedata_mod: MODULE obsSpaceData_mod (prefix=’obs’ category=’6. High-level data objects’)

  • randomnumber_mod: MODULE randomNumber_mod (prefix=’rng’ category=’8. Low-level utilities and constants’)

  • mathphysconstants_mod: MODULE mathPhysConstants_mod (prefix=’mpc’ category=’8. Low-level utilities and constants’)

  • utilities_mod: MODULE utilities_mod (prefix=’utl’ category=’8. Low-level utilities and constants’)

  • earthconstants_mod: MODULE earthConstants_mod (prefix=’ec’ category=’8. Low-level utilities and constants’)

  • bufr_mod: MODULE bufr_mod (prefix=’bufr’ category=’8. Low-level utilities and constants’)

  • codeprecision_mod: MODULE codePrecision_mod (prefix=’pre’ category=’8. Low-level utilities and constants’)

  • codtyp_mod: MODULE codtyp_mod (prefix=’codtyp’ category=’8. Low-level utilities and constants’)

  • obsfamilylist_mod: MODULE obsFamilyList_mod (prefix=’ofl’ category=’7. Low-level data objects’)

  • varnamelist_mod: MODULE varNameList_mod (prefix=’vnl’ category=’7. Low-level data objects’)

Types

  • type  ensembleobservations_mod/struct_eob
    Type fields
    • % allocated [logical ]

    • % assflag (*) [integer ,allocatable] :: assimilation flag

    • % deteryb (*) [real ,allocatable] :: deterministic background state in obs space

    • % filememberindex1 [integer ] :: first member number in ensemble set

    • % lat (*) [real ,allocatable]

    • % lon (*) [real ,allocatable] :: lat/lon of observation

    • % meanremoved [logical ]

    • % meanyb (*) [real ,allocatable] :: ensemble mean background state in obs space

    • % nummembers [integer ] :: number of ensemble members

    • % numobs [integer ] :: number of observations

    • % obserrinv (*) [real ,allocatable] :: inverse of obs error variances

    • % obserrinv_sim (*) [real ,allocatable] :: like obsErrInv, used when simulating observations

    • % obsspacedata [struct_obs ,pointer] :: pointer to obsSpaceData object

    • % obsvalue (*) [real ,allocatable] :: the observed value

    • % randpert_r4 (*,*) [real ,allocatable] :: unbiased random perturbations with covariance equal to R

    • % typevertcoord [character ] :: ‘logPressure’ or ‘depth’

    • % vertlocation (*) [real ,allocatable] :: in ln(pres) or meters, used for localization

    • % ya_r4 (*,*) [real ,allocatable] :: analysis ensemble perturbation in obs space

    • % yb_r4 (*,*) [real ,allocatable] :: background ensemble perturbation in obs space

Variables

  • ensembleobservations_mod/eob_simobsassim [logical,public]

Subroutines and functions

subroutine  ensembleobservations_mod/eob_init()

: Purpose: This subroutine reads the namelist section NAMENSOBS for this module.

Called from

eob_allocate(), eob_setobserrinv()

Call to

utl_isnamelistpresent(), utl_abort(), codtyp_get_codtyp(), vnl_varnumfromvarname()

subroutine  ensembleobservations_mod/eob_allocate(ensobs, nummembers, numobs, obsspacedata[, filememberindex1_opt])
Purpose

Allocate an ensObs object

Arguments
  • ensobs [struct_eob ,inout]

  • nummembers [integer ,in]

  • numobs [integer ,in]

  • obsspacedata [struct_obs ,in,target]

Options

filememberindex1_opt [integer ,in,]

Called from

eob_clean(), eob_allgather(), omf_ominusfens(), midas_ensembleh, midas_letkf

Call to

eob_deallocate(), eob_init()

subroutine  ensembleobservations_mod/eob_deallocate(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

eob_allocate(), eob_allgather()

subroutine  ensembleobservations_mod/eob_zero(ensobs)
Purpose

Initialize an ensObs object to zero

Arguments

ensobs [struct_eob ,inout]

Called from

omf_ominusfens(), midas_ensembleh, midas_letkf

Call to

utl_abort()

subroutine  ensembleobservations_mod/eob_settypevertcoord(ensobs, typevertcoord)
Purpose

Set the type of vertical coordinate (‘logPressure’ or ‘depth’).

Arguments
  • ensobs [struct_eob ,inout]

  • typevertcoord [character ,in]

Called from

midas_letkf

Call to

utl_abort()

subroutine  ensembleobservations_mod/eob_clean(ensobs, ensobsclean)
Purpose

Remove all obs from the ensObs object that are not flagged for assimilation. Put the cleaned result in the locally created output object.

Arguments
  • ensobs [struct_eob ,inout]

  • ensobsclean [struct_eob ,out]

Called from

eob_allgather()

Call to

eob_setassflag(), eob_allocate()

subroutine  ensembleobservations_mod/eob_copy(ensobsin, ensobsout)
Arguments
  • ensobsin [struct_eob ,in]

  • ensobsout [struct_eob ,inout]

subroutine  ensembleobservations_mod/eob_allgather(ensobs, ensobs_mpiglobal)
Purpose

Collect obs information distributed over all mpi tasks and make it available on all mpi tasks. The output ensObs object will be allocated within this subroutine.

Arguments
  • ensobs [struct_eob ,inout]

  • ensobs_mpiglobal [struct_eob ,out]

Called from

midas_letkf

Call to

utl_tmg_start(), eob_setassflag(), eob_clean(), utl_abort(), eob_allocate(), eob_deallocate(), utl_tmg_stop()

subroutine  ensembleobservations_mod/eob_writetofiles(ensobs, outputfilenameprefix, writeobsinfo[, numgroupstodividemembers_opt[, maxnummemberspergroup_opt]])
Purpose

Write the contents of an ensObs mpi local object to files

Arguments
  • ensobs [struct_eob ,in]

  • outputfilenameprefix [character ,in]

  • writeobsinfo [logical ,in]

Options
  • numgroupstodividemembers_opt [integer ,in,]

  • maxnummemberspergroup_opt [integer ,in,]

Called from

midas_ensembleh, midas_letkf

Call to

utl_abort(), obs_extractobsintbodycolumn(), getmemberindexinfullensset()

subroutine  ensembleobservations_mod/eob_readfromfiles(ensobs, nummemberstoread, inputfilenameprefix, readobsinfo)
Purpose

Read mpi local ensObs%Yb object from file. Several files in separate subdirectories can be read. Some examples of path+filename are: ensObs_0001/eob_HX_0001_0001 ensObs_0002/eob_HX_0001_0001

Arguments
  • ensobs [struct_eob ,inout]

  • nummemberstoread [integer ,in]

  • inputfilenameprefix [character ,in]

  • readobsinfo [logical ,in]

Called from

midas_letkf

Call to

utl_abort(), obs_extractobsintbodycolumn(), obs_bodyset_i()

function  ensembleobservations_mod/eob_getlocalbodyindices(ensobs, localbodyindices, distances, lat, lon, vertlocation, hlocalize, vlocalize, numlocalobsfound)
Purpose

Return a list of values of bodyIndex for all observations within the local volume around the specified lat/lon used for assimilation (as defined by h/vLocalize). The kdtree2 module is used to efficiently perform this task. The kdtree itself is constructed on the first call.

Arguments
  • ensobs [struct_eob ,in]

  • localbodyindices (*) [integer ,out]

  • distances (*) [real ,out]

  • lat [real ,in]

  • lon [real ,in]

  • vertlocation [real ,in]

  • hlocalize [real ,in]

  • vlocalize [real ,in]

  • numlocalobsfound [integer ,out]

Return

numlocalobs [integer ] :: function output

Called from

enkf_letkfanalyses()

Call to

kdtree2_create(), kdtree2_r_nearest(), utl_abort()

subroutine  ensembleobservations_mod/eob_setlatlonobs(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

omf_ominusfens(), midas_ensembleh, midas_letkf

Call to

obs_extractobsrealheadercolumn(), obs_extractobsrealbodycolumn()

subroutine  ensembleobservations_mod/eob_setobserrinv(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_extractobsrealbodycolumn(), eob_init(), eob_setpsvobserrinv(), eob_setsimobserrinv()

subroutine  ensembleobservations_mod/eob_setpsvobserrinv(ensobs)
Purpose

Updates the inverse of the observation error variance for passive osbervations and stores this in ensObs%obsErrInv. This is done assuming that ensObs%obsErrInv was already set.

Arguments

ensobs [struct_eob ,inout]

Called from

eob_setobserrinv()

Call to

obs_bodyelem_i(), obs_getfamily(), obs_headelem_i(), obs_bodyset_i()

subroutine  ensembleobservations_mod/eob_setsimobserrinv(ensobs)
Purpose

Computes the inverse of the observation error variance if simulating any observations. Stores this in ensObs%obsErrInv_sim.

Arguments

ensobs [struct_eob ,inout]

Called from

eob_setobserrinv()

Call to

obs_bodyelem_i(), obs_getfamily(), obs_headelem_i(), obs_bodyset_i()

subroutine  ensembleobservations_mod/eob_setvertlocation(ensobs, columnmeantrl)
Purpose

Set the vertical location value for each observation that will be used when doing vertical localization. For radiance observations, the level of the maximum value of the derivative of transmission is used. This value is also written in obsSpaceData in the OBS_ZHA column.

Arguments
  • ensobs [struct_eob ,inout]

  • columnmeantrl [struct_columndata ,in]

Called from

midas_letkf

Call to

eob_setassflag(), obs_extractobsrealbodycolumn(), obs_extractobsintbodycolumn(), obs_extractobsintheadercolumn(), col_getallcolumns(), col_getnumlev(), tvs_getprofile(), obs_bodyelem_i(), utl_abort(), bufr_isoceanobs(), tvs_isidburptovs(), max_transmission()

subroutine  ensembleobservations_mod/eob_setassflag(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

eob_clean(), eob_allgather(), eob_setvertlocation(), midas_letkf

Call to

obs_extractobsintbodycolumn()

subroutine  ensembleobservations_mod/eob_setyb(ensobs, memberindex)
Arguments
  • ensobs [struct_eob ,inout]

  • memberindex [integer ,in]

Called from

omf_ominusfens(), midas_ensembleh, midas_letkf

Call to

obs_extractobsrealbodycolumn_r4()

subroutine  ensembleobservations_mod/eob_setya(ensobs, memberindex, obscolumnname)
Arguments
  • ensobs [struct_eob ,inout]

  • memberindex [integer ,in]

  • obscolumnname [integer ,in]

Called from

midas_letkf

Call to

utl_abort(), obs_extractobsrealbodycolumn_r4()

subroutine  ensembleobservations_mod/eob_setsimobsval(ensobs)
Purpose

Set the observed value for simulated observations to the background ensemble mean in observation space.

Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_bodyelem_i(), obs_getfamily(), obs_headelem_i()

subroutine  ensembleobservations_mod/eob_setdeteryb(ensobs)
Arguments

ensobs [struct_eob ,inout]

Call to

obs_extractobsrealbodycolumn()

subroutine  ensembleobservations_mod/eob_calcandremovemeanyb(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

subroutine  ensembleobservations_mod/eob_calcrandpert(ensobs, randomseed)
Arguments
  • ensobs [struct_eob ,inout]

  • randomseed [integer ,in]

Called from

midas_letkf

Call to

rng_setup(), utl_abort(), obs_bodyelem_r(), rng_gaussian()

subroutine  ensembleobservations_mod/eob_setmeanomp(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_bodyelem_i()

subroutine  ensembleobservations_mod/eob_sethpht(ensobs)
Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_bodyelem_i()

subroutine  ensembleobservations_mod/eob_backgroundcheck(ensobs)
Purpose

Apply additional background using the ensemble spread.

Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_numheader(), obs_headelem_i(), obs_bodyelem_i(), obs_bodyelem_r(), obs_bodyset_i(), bufr_iswindcomponent()

subroutine  ensembleobservations_mod/eob_removeobsnearland(ensobs, oceanmask, mindistancetoland)
Purpose

Reject observations that are close to land as determined by the argument “minDistanceToLand”. In the case of a depth- varying land mask, the first level (should be the surface) is used.

Arguments
  • ensobs [struct_eob ,inout]

  • oceanmask [struct_ocm ,in]

  • mindistancetoland [real ,in]

Called from

midas_letkf

Call to

obs_numheader(), obs_headelem_i(), obs_headelem_r(), ocm_farfromland(), obs_bodyelem_i(), obs_bodyset_i()

subroutine  ensembleobservations_mod/eob_setsigisigo(ensobs)
Purpose

Apply huber norm quality control procedure. This modifies the OBS_OER value, but before that its value is copied into OBS_SIGO and also OBS_SIGI computed

Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_numbody(), obs_bodyelem_r(), obs_bodyelem_i()

subroutine  ensembleobservations_mod/eob_hubernorm(ensobs)
Purpose

Apply huber norm quality control procedure. This modifies the OBS_OER value.

Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_numheader(), obs_headelem_i(), obs_bodyelem_r(), obs_bodyelem_i(), bufr_iswindcomponent()

subroutine  ensembleobservations_mod/eob_rejectradnearsfc(ensobs)
Purpose

Reject all radiance observations with peak sensitivity too close to the surface.

Arguments

ensobs [struct_eob ,inout]

Called from

midas_letkf

Call to

obs_numbody(), obs_bodyelem_i(), obs_bodyset_i()

subroutine  ensembleobservations_mod/getmemberindexinfullensset(ensobs, memberindexarray[, numgroupstodividemembers_opt[, maxnummemberspergroup_opt]])
Purpose

get memberIndex array corresponding to the full ensemble set. This is useful when ensObs is a subset of full ensemble members. If first member in ensObs is member 6, to get the full ensemble set equivalent of ensObs members: a) When members are not grouped (numGroupsToDivideMembers=1), all members are offset by

memberIndexOffset (e.g. 6, 7, …, 6+ensObs%numMermbers)

  1. When members are grouped (numGroupsToDivideMembers/=1), members within each group are offset by memberIndexOffset but there is increment of maxNumMembersPerGroup_opt to jump to the next group (e.g. if maxNumMembersPerGroup_opt=10, for first group 6, 7, 8, 9, for second group 6+10, 7+10, 8+10, 9+10, and so on)

Arguments
  • ensobs [struct_eob ,in]

  • memberindexarray (*) [integer ,inout]

Options
  • numgroupstodividemembers_opt [integer ,in,]

  • maxnummemberspergroup_opt [integer ,in,]

Called from

eob_writetofiles()

Call to

utl_abort()

subroutine  ensembleobservations_mod/max_transmission(transmission, numlevels, transindex, rttovpres, maxlnp)
Purpose

Determine the height in log pressure where we find the maximum value of the first derivative of transmission with respect to log pressure

Arguments
  • transmission [rttov_transmission ,in] :: transmission (rttov type)

  • numlevels [integer ,in] :: number of RTTOV levels

  • transindex [integer ,in] :: index of transmission%tau_levels

  • rttovpres (*) [real ,in,pointer] :: pressure of RTTOV levels

  • maxlnp [real ,out] :: log pressure of maximum

Called from

eob_setvertlocation()

Call to

get_peak()

subroutine  ensembleobservations_mod/get_peak(maxindex, nlev, lnp, deriv, maxlnp)
Purpose

Do quadratic interpolation to find pressure of peak transmission.

Arguments
  • maxindex [integer ,in]

  • nlev [integer ,in,]

  • lnp (nlev) [real ,in]

  • deriv (nlev + 1) [real ,in]

  • maxlnp [real ,inout]

Called from

max_transmission()