bCovarSetupChem_mod

link to source code

Dependency Diagrams:

bCovarSetupChem_mod.svg

Direct Dependency Diagram

bCovarSetupChem_mod_rev.svg

Reverse Dependency Diagram

Description

MODULE bCovarSetupChem_mod (prefix=’bcsc’ category=’6. High-level data objects’)

Purpose

Contains routines for the reading and preparation of background-error covariance elements. Correlation matrices based on horizontally homogeneous/isotropic correlations.

Comments
  1. Covariances uncoupled from weather variable.

  2. Handles univariate and multivariate covariances. See routines bcsc_readcorns2 and bcsc_sucorns2.

  3. For multiple univariate variables (or univarite blocks of one to multiple variables), one can alternatively have multiple sets of covariance matrices within this module instead of a single covariance matrix setup (similarly to what was done for corvert*).

Quick access

Variables

struct_bcsc_bgstats

Routines

bcsc_addbgstddev(), bcsc_convol(), bcsc_corvertsetup(), bcsc_finalize(), bcsc_getbgstddev(), bcsc_getcovarch(), bcsc_getscalefactor(), bcsc_rdspstd(), bcsc_rdspstd_newfmt(), bcsc_rdstats(), bcsc_rdstd(), bcsc_rdstd3d(), bcsc_rdstddev(), bcsc_readcorns2(), bcsc_resetcorvert(), bcsc_resethcorrlen(), bcsc_retrievebgstddev(), bcsc_scalestd(), bcsc_setupch(), bcsc_statsexistforvarname(), bcsc_sucorns2(), readcorns(), writecorns()

Needed modules

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

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

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

  • obssubspacedata_mod: MODULE obsSubSpaceData_mod (prefix=’oss’ category=’6. High-level data objects’)

  • gridstatevector_mod: MODULE gridStateVector_mod (prefix=’gsv’ category=’6. High-level data objects’)

  • globalspectraltransform_mod: MODULE globalSpectralTransform_mod (prefix=’gst’ category=’4. Data Object transformations’)

  • horizontalcoord_mod: MODULE horizontalCoord_mod (prefix=’hco’ category=’7. Low-level data objects’)

  • verticalcoord_mod: MODULE verticalCoord_mod (prefix=’vco’ category=’7. Low-level data objects’)

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

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

  • calcheightandpressure_mod: MODULE calcHeightAndPressure_mod (prefix=’czp’ category=’4. Data Object transformations’)

Types

  • type  bcovarsetupchem_mod/unknown_type
    Type fields
    • % corns (*,*,*) [real ,allocatable]

    • % corvert (*,*,*) [real ,allocatable]

    • % corverti (*,*,*) [real ,allocatable]

    • % hcorrlen (*,*) [real ,allocatable]

    • % initialized [logical ]

    • % lat (*) [real ,allocatable]

    • % lon (*) [real ,allocatable]

    • % ni [integer ]

    • % nj [integer ]

    • % nkgdim [integer ]

    • % nlev [integer ]

    • % nsposit (*) [integer ,allocatable]

    • % ntrunc [integer ]

    • % numvar2d [integer ]

    • % numvar3d [integer ]

    • % stddev (*,*,*) [real ,allocatable]

    • % varnamelist (*) [character ,allocatable]

    • % vlev (*) [real ,allocatable]

Variables

  • bcovarsetupchem_mod/struct_bcsc_bgstats [public]

Subroutines and functions

subroutine  bcovarsetupchem_mod/bcsc_setupch(hco_in, vco_in, covarneeded, mode)
Purpose

Set up for constituents static background error covariances.

Arguments
  • hco_in [struct_hco ,in,pointer]

  • vco_in [struct_vco ,in,pointer]

  • covarneeded [logical ,out]

  • mode [character ,in] :: ‘Analysis’ or ‘BackgroundCheck’

Called from

bchm_setupch(), ose_compute_hbht_static_chem()

Call to

gsv_varexist(), vnl_varkindfromvarname(), utl_abort(), gst_setup(), bcsc_rdstats(), bcsc_sucorns2()

subroutine  bcovarsetupchem_mod/bcsc_getscalefactor(scalefactorout)
Purpose

To set scaling factors for background error std. dev.

Arguments

scalefactorout (*,*) [real ,out] :: Error std. dev. scale factor

Called from

osd_calcinflation()

subroutine  bcovarsetupchem_mod/bcsc_rdstats()
Purpose

To read chemical constituents background stats file.

Called from

bcsc_setupch()

Call to

utl_abort(), vco_setupfromfile(), vco_equal(), bcsc_readcorns2(), bcsc_rdstddev(), bcsc_scalestd()

subroutine  bcovarsetupchem_mod/bcsc_scalestd()
Purpose

To scale error standard-deviation values.

Called from

bcsc_rdstats()

Call to

utl_fstecr()

subroutine  bcovarsetupchem_mod/bcsc_readcorns2()
Purpose

To read correlation information and to form the correlation matrix.

Notes

Can read distinct block diagonal matrices with or without cross-correlations.

Called from

bcsc_rdstats()

Call to

utl_fstlir(), utl_abort(), bcsc_convol()

subroutine  bcovarsetupchem_mod/bcsc_convol()
Called from

bcsc_readcorns2()

Call to

gst_getrmu(), gst_zleginv(), gst_zlegdir(), utl_fstlir(), gst_getzleg(), utl_fstecr()

subroutine  bcovarsetupchem_mod/bcsc_rdstddev()
Purpose

To read stddev and to set as 3D fields.

Called from

bcsc_rdstats()

Call to

utl_fstlir(), bcsc_rdstd3d(), bcsc_rdstd(), bcsc_rdspstd(), utl_abort()

subroutine  bcovarsetupchem_mod/bcsc_rdspstd()
Called from

bcsc_rdstddev(), bcsc_rdspstd_newfmt()

Call to

utl_fstlir(), utl_abort(), gst_zleginv()

subroutine  bcovarsetupchem_mod/bcsc_rdspstd_newfmt()
Call to

bcsc_rdspstd(), vnl_varlevelfromvarname(), utl_fstlir(), utl_abort(), gst_zleginv()

subroutine  bcovarsetupchem_mod/bcsc_rdstd()
Purpose

To read 2D stddev and to store as 3D

Called from

bcsc_rdstddev()

Call to

utl_abort(), utl_fstlir(), gsv_field3d_hbilin()

subroutine  bcovarsetupchem_mod/bcsc_rdstd3d()
Purpose

To read 3D stddev.

Originally based on bcsc_rdspstd_newfmt

Called from

bcsc_rdstddev()

Call to

vnl_varlevelfromvarname(), utl_abort(), utl_fstlir(), gsv_field3d_hbilin()

subroutine  bcovarsetupchem_mod/bcsc_sucorns2()
Called from

bcsc_setupch()

Call to

gasparicohn(), bcsc_corvertsetup(), readcorns(), utl_abort(), writecorns()

subroutine  bcovarsetupchem_mod/bcsc_corvertsetup()
Purpose

To compute total vertical correlations (bcsc_corvert) and its inverse (bgStats%corverti; currently for each block matrix).

Note

Currently assumes no (or neglects) cross-correlations

Called from

bcsc_sucorns2()

Call to

readcorns(), utl_abort(), utl_fstecr(), writecorns()

subroutine  bcovarsetupchem_mod/writecorns(nmat, cletiket, nlev)
Arguments
  • nmat [integer ,in]

  • cletiket [character ,in]

  • nlev [integer ,in]

Called from

bcsc_sucorns2(), bcsc_corvertsetup()

Call to

utl_fstecr()

subroutine  bcovarsetupchem_mod/readcorns(lfound, nmat, cletiket)
Arguments
  • lfound (*) [logical ,out]

  • nmat [integer ,in]

  • cletiket [character ,in]

Called from

bcsc_sucorns2(), bcsc_corvertsetup()

Call to

utl_fstlir(), utl_abort()

function  bcovarsetupchem_mod/gasparicohn(ztlen, zr)
Arguments
  • ztlen [real ,in]

  • zr [real ,in]

Return

gasparicohn [real ]

subroutine  bcovarsetupchem_mod/bcsc_finalize()
Called from

bchm_finalize()

subroutine  bcovarsetupchem_mod/bcsc_getcovarch(bgstatsout[, transformvarkind_opt])
Purpose

Pass on covariances in bgStats

Arguments

bgstatsout [struct_bcsc_bgstats ,out] :: Structure with covariance elements

Options

transformvarkind_opt [character ,out,] :: Name of variable transform to apply to chemistry variables

Called from

bchm_setupch(), oopc_setupch()

Call to

utl_abort()

subroutine  bcovarsetupchem_mod/bcsc_resetcorvert(nlev_t, vlev_t)
Purpose

Vertically interpolate error correlation matrix fields to generate approximate matrices/vectors in trial field vertical levels via interpolation. No need to make matrix positive definite for this approximation.

Arguments
  • nlev_t [integer ,in] :: Number of vertical levels for trial fields

  • vlev_t (*) [real ,in,pointer] :: Trial field vertical levels

subroutine  bcovarsetupchem_mod/bcsc_resethcorrlen(nlev_t, vlev_t)
Purpose

To interpolate horizontal correlation length to trial field vertical levels.

Arguments
  • nlev_t [integer ,in] :: Number of target vertical levels

  • vlev_t (*) [real ,in] :: Target vertical levels

function  bcovarsetupchem_mod/bcsc_statsexistforvarname(varname)
Purpose

To check whether covariances have been made available for the specified variable

Arguments

varname [character ,in]

Return

bcsc_statsexistforvarname [logical ]

subroutine  bcovarsetupchem_mod/bcsc_getbgstddev(varname, maxsize, xlat, xlong, stddevout[, vlev_opt])
Purpose

To interpolate error std. dev. to obs location.

Arguments
  • varname [character ,in] :: Variable name

  • maxsize [integer ,in] :: Max array size

  • xlat [real ,in] :: Target latitude

  • xlong [real ,in] :: Target longitude

  • stddevout (*) [real ,out] :: Error std. dev.

Options

vlev_opt (*) [real ,in,] :: Target vertical levels

Call to

utl_abort()

subroutine  bcovarsetupchem_mod/bcsc_addbgstddev(headerindex, stddevin, obsdatamaxsize)
Purpose

To add background stddev profiles (and inverse) to bgStddev which can be retrieved later using a header index.

Arguments
  • headerindex [integer ,in]

  • stddevin (*,*) [real ,in]

  • obsdatamaxsize [integer ,in]

Call to

oss_obsdata_alloc(), utl_abort()

function  bcovarsetupchem_mod/bcsc_retrievebgstddev(dim1, dim2, headerindex)
Purpose

To retrieve previously saved background stddev profiles in bgStddev from the header index of the observation.

Arguments
  • dim1 [integer ,in] :: Dimensions of output array

  • dim2 [integer ,in] :: Dimensions of output array

  • headerindex [integer ,in] :: Index of observation

Return

stddevout (dim1,dim2) [real ]

Call to

utl_abort(), oss_obsdata_get_array2d()