calcStatsGlb_mod

link to source code

Dependency Diagrams:

calcStatsGlb_mod.svg

Direct Dependency Diagram

calcStatsGlb_mod_rev.svg

Reverse Dependency Diagram

Description

MODULE calcStatsGlb_mod (prefix=’csg’ category=’1. High-level functionality’)

Purpose

To compute homogeneous and isotropic background error covariances from forecast error estimate in model variable space (global version).

Quick access

Routines

calcbalancedp(), calccorrelations(), calccorrelations2(), calclocalvertcorrmatrix(), calcpowerspec(), calcptot(), calcstddev3d(), calctheta(), calcvertmodesspec(), calczonavg(), csg_computebhi(), csg_computebhilatbands(), csg_computebhilegacy(), csg_setup(), csg_toolbox(), multiply3d(), normalize3d(), readensemble(), removebalancedchi(), removebalancedt_ps(), removeglobalmean(), removemean(), spectralfilter(), spectralfilter2(), uv_to_psichi(), vertmodesfilter(), write3d(), writepowerspec(), writespstats(), writestats(), writestddev(), writestddevbal()

Needed modules

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

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

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

  • gridstatevectorfileio_mod: MODULE gridStateVectorFileIO_mod (prefix=’gio’ category=’4. Data Object transformations’)

  • ensemblestatevector_mod: MODULE ensembleStateVector_mod (prefix=’ens’ category=’6. High-level data objects’)

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

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

  • 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’)

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

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

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

  • spectralfilter_mod: MODULE spectralFilter_mod (prefix=’spf’ category=’8. Low-level utilities and constants’)

  • menetrierdiag_mod: MODULE menetrierDiag_mod (prefix=’bmd’ category=’1. High-level functionality’)

  • filenames_mod: MODULE fileNames_mod (prefix=’fln’ category=’7. Low-level data objects’)

  • timecoord_mod: MODULE timeCoord_mod (prefix=’tim’ category=’7. Low-level data objects’)

  • gridvariabletransforms_mod: MODULE gridVariableTransforms_mod (prefix=’gvt’ category=’4. Data Object transformations’)

  • gridbinning_mod: MODULE gridBinning_mod (prefix=’gbi’ category=’4. Data Object transformations’)

  • verticalmodes_mod: MODULE verticalModes_mod (prefix=’vms’ category=’4. Data Object transformations’)

Variables

Subroutines and functions

subroutine  calcstatsglb_mod/csg_setup(nens_in, hco_in, vco_in)
Purpose

Main setup routine for this module

Arguments
  • nens_in [integer ,in]

  • hco_in [struct_hco ,in,pointer]

  • vco_in [struct_vco ,in,pointer]

Called from

midas_calcstats

Call to

fln_ensfilename(), mpc_printconstants(), pre_printprecisions(), utl_abort(), mmpi_setup_latbands(), mmpi_setup_lonbands(), gst_setup(), mmpi_setup_m(), mmpi_setup_n(), gst_ilalist_mpiglobal(), gst_ilalist_mpilocal(), mmpi_setup_levels()

subroutine  calcstatsglb_mod/csg_computebhi()
Purpose

Master routine for Bhi computation in global mode

Called from

midas_calcstats

Call to

utl_abort(), csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/csg_computebhilegacy()
Purpose

Computation of Bhi using the legacy formulation

Called from

csg_computebhi()

Call to

readensemble(), removemean(), uv_to_psichi(), calcstddev3d(), calczonavg(), calctheta(), removebalancedchi(), normalize3d(), calcptot(), removebalancedt_ps(), multiply3d(), spectralfilter(), removeglobalmean(), calccorrelations(), writestats(), writestddev(), writestddevbal(), writespstats()

subroutine  calcstatsglb_mod/csg_computebhilatbands()
Purpose

Computation of Bhi on a set of latitude bands

Called from

csg_computebhi()

Call to

readensemble(), removemean(), uv_to_psichi(), calcstddev3d(), calczonavg(), normalize3d(), removeglobalmean(), calccorrelations(), writestats(), writestddev()

subroutine  calcstatsglb_mod/csg_toolbox()
Purpose

High-level routine to do a variety of diagnostic operations on the ensemble of error samples

Called from

midas_calcstats

Call to

utl_abort(), ens_allocate(), ens_readensemble(), ens_modifyvarname(), ens_computemean(), ens_removemean(), spectralfilter2(), ens_computestddev(), ens_normalize(), ens_removeglobalmean(), calccorrelations2(), writestats(), calchorizscale(), horizcorrelfunction(), calclocalcorrelations(), calclocalvertcorrmatrix(), vms_computemodesfromfunction(), vertmodesfilter(), ens_copyensstddev(), bmd_setup(), bmd_localizationradii(), gvt_setup(), ens_varexist(), gio_writetofile(), gbi_setup(), calcpowerspec(), writepowerspec(), vms_writemodes(), calcvertmodesspec(), ens_copymember(), writepressureprofiles(), ens_deallocate()

subroutine  calcstatsglb_mod/writespstats(ptot, theta)
Purpose

Write the spectral representation of PtoT and THETA to files

Arguments
  • ptot (*,*,*) [real ,in]

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

Called from

csg_computebhilegacy()

Call to

gst_zlegdir(), utl_fstecr()

subroutine  calcstatsglb_mod/removebalancedchi(ensperturbations, theta)
Purpose

Subtract the balanced components of velocity potential from the full variable

Arguments
  • ensperturbations (*,*,*,*) [real ,inout,pointer]

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

Called from

csg_computebhilegacy()

subroutine  calcstatsglb_mod/removebalancedt_ps(ensperturbations, ensbalperturbations, ptot)
Purpose

Subtract the balanced components of temperature and surface pressure from the full variables

Arguments
  • ensperturbations (*,*,*,*) [real ,inout,pointer]

  • ensbalperturbations (*,*,*,*) [real ,inout,pointer]

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

Called from

csg_computebhilegacy()

Call to

gst_setid(), gst_reespe(), calcbalancedp(), gst_speree()

subroutine  calcstatsglb_mod/calccorrelations(ensperturbations, corns, rstddev[, latmask_opt])
Purpose

Calculate the homogeneous and isotropic correlations in spectral space

Arguments
  • ensperturbations (*,*,*,*) [real ,in,pointer]

  • corns (nkgdimens,nkgdimens,ntrunc)+1) [real ,out]

  • rstddev (nkgdimens,ntrunc)+1) [real ,out]

Options

latmask_opt (*) [real ,in,]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

Call to

utl_tmg_start(), gst_setid(), gst_reespe(), gst_getnind(), utl_tmg_stop()

subroutine  calcstatsglb_mod/calccorrelations2(ensperts, corns, rstddev[, latmask_opt])
Purpose

Calculate the homogeneous and isotropic correlations in spectral space

Arguments
  • ensperts [struct_ens ,inout]

  • corns (nkgdimens,nkgdimens,ntrunc)+1) [real ,out]

  • rstddev (nkgdimens,ntrunc)+1) [real ,out]

Options

latmask_opt (*) [real ,in,]

Called from

csg_toolbox()

Call to

utl_tmg_start(), ens_getnumk(), ens_getonelev_r4(), gst_setid(), gst_reespe(), gst_getnind(), utl_tmg_stop()

subroutine  calcstatsglb_mod/calcpowerspec(ensperts, powerspec)
Purpose

Calculate the horizontal power spectrum of the ensemble of error samples

Arguments
  • ensperts [struct_ens ,inout]

  • powerspec (*,*) [real ,out,allocatable]

Called from

csg_toolbox()

Call to

ens_getnumk(), gst_setup(), ens_getonelev_r4(), gst_setid(), gst_reespe_kij(), gst_getnind(), mmpi_allreduce_sumr8_2d()

subroutine  calcstatsglb_mod/writestats(corns, rstddev[, ptot_opt[, theta_opt[, wavebandindex_opt[, latband_opt]]]])
Purpose

Write several components of the BHI matrix to a file

Arguments
  • corns (nkgdimens,nkgdimens,ntrunc)+1) [real ,in]

  • rstddev (nkgdimens,ntrunc)+1) [real ,in]

Options
  • ptot_opt (*,*,*) [real ,in,]

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

  • wavebandindex_opt [integer ,in,]

  • latband_opt [integer ,in,]

Called from

csg_computebhilegacy(), csg_computebhilatbands(), csg_toolbox()

Call to

utl_abort(), utl_fstecr()

subroutine  calcstatsglb_mod/writepressureprofiles()
Purpose

Write the profiles of pressure to ascii files

subroutine  calcstatsglb_mod/writestddev(stddevzonavg, stddev3d[, stddevzonavgunbal_opt[, stddev3dunbal_opt]])
Purpose

Write the stddev to a file

Arguments
  • stddevzonavg (*,*) [real ,in,pointer]

  • stddev3d (*,*,*) [real ,in,pointer]

Options
  • stddevzonavgunbal_opt (*,*) [real ,in,pointer]

  • stddev3dunbal_opt (*,*,*) [real ,in,pointer]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

Call to

gsv_allocate(), gsv_getnumlevfromvarname(), gio_writetofile(), utl_fstecr(), gsv_deallocate()

subroutine  calcstatsglb_mod/writestddevbal(stddevzonavgbal, stddev3dbal)
Purpose

Write the stddev of the balanced variables to a file

Arguments
  • stddevzonavgbal (*,*) [real ,in]

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

Called from

csg_computebhilegacy()

Call to

gsv_allocate(), gsv_getnumlevfromvarname(), gio_writetofile(), utl_fstecr(), gsv_deallocate()

subroutine  calcstatsglb_mod/spectralfilter(ensperturbations, nlev[, wavebandindex_opt])
Purpose

Apply a spectral filter

Arguments
  • ensperturbations (*,*,*,*) [real ,inout,pointer]

  • nlev [integer ,in]

Options

wavebandindex_opt [integer ,in,]

Called from

csg_computebhilegacy()

Call to

utl_abort(), spf_filterresponsefunction(), gst_setid(), gst_reespe(), gst_getnind(), gst_speree()

subroutine  calcstatsglb_mod/spectralfilter2(ensperts_in, ensperts_out[, wavebandindex_opt])
Purpose

Apply a spectral filter

Arguments
  • ensperts_in [struct_ens ,inout]

  • ensperts_out [struct_ens ,inout]

Options

wavebandindex_opt [integer ,in,]

Called from

csg_toolbox()

Call to

utl_abort(), spf_filterresponsefunction(), gst_setup(), ens_getnumk(), ens_getonelev_r4(), gst_setid(), gst_reespe_kij(), gst_getnind(), gst_speree_kij()

subroutine  calcstatsglb_mod/calctheta(ensperturbations, theta)
Purpose

Calculate the Theta turning angle according to Ekman balance

Arguments
  • ensperturbations (*,*,*,*) [real ,in,pointer]

  • theta (*,*) [real ,out]

Called from

csg_computebhilegacy()

subroutine  calcstatsglb_mod/calcptot(ensperturbations, ptot)
Purpose

Calculate the “P” to Temperature transform matrix using a regression analysis of the “P” and temperature samples

Arguments
  • ensperturbations (*,*,*,*) [real ,in,pointer]

  • ptot (*,*,*) [real ,out]

Called from

csg_computebhilegacy()

Call to

gst_getrlati(), gst_setid(), gst_reespe(), calcbalancedp(), gst_speree()

subroutine  calcstatsglb_mod/removeglobalmean(ensperturbations)
Purpose

Calculate and subtract the horizontal mean value from the ensemble of samples for each member, vertical level and variable

Arguments

ensperturbations (*,*,*,*) [real ,inout,pointer]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/calczonavg(fieldszonavg_mpiglobal, fields3d, nlev)
Purpose

Calculate the zonal average of the supplied 3D fields

Arguments
  • fieldszonavg_mpiglobal (*,*) [real ,inout,pointer]

  • fields3d (*,*,*) [real ,in,pointer]

  • nlev [integer ,in]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/calcstddev3d(ensperturbations, stddev3d, nlev)
Purpose

Calculate the 3d stddev field

Arguments
  • ensperturbations (*,*,*,*) [real ,in,pointer]

  • stddev3d (*,*,*) [real ,inout,pointer]

  • nlev [integer ,in]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/calcbalancedp(sppsi, spgz)
Purpose

Calculate the balanced “P” variable using geostrophy

Arguments
  • sppsi (*,*,*) [real ,in]

  • spgz (*,*,*) [real ,out]

Called from

removebalancedt_ps(), calcptot()

Call to

gst_getrnnp1()

subroutine  calcstatsglb_mod/normalize3d(ensperturbations, stddev3d)
Purpose

Divide the ensemble perturbations by the supplied 3d stddev field

Arguments
  • ensperturbations (*,*,*,*) [real ,inout,pointer]

  • stddev3d (*,*,*) [real ,in,pointer]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/multiply3d(ensperturbations, stddev3d, nlev)
Purpose

Multiply the ensemble perturbations by the supplied 3d stddev field

Arguments
  • ensperturbations (*,*,*,*) [real ,inout,pointer]

  • stddev3d (*,*,*) [real ,in,pointer]

  • nlev [integer ,in]

Called from

csg_computebhilegacy()

subroutine  calcstatsglb_mod/readensemble(ensperturbations)
Purpose

Read the ensemble of error samples from files

Arguments

ensperturbations (*,*,*,*) [real ,inout,pointer]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

Call to

ens_allocate(), ens_readensemble(), gsv_allocate(), ens_copymember(), gsv_deallocate(), ens_deallocate()

subroutine  calcstatsglb_mod/uv_to_psichi(ensperturbations)
Purpose

Transform wind components to Psi and Chi

Arguments

ensperturbations (*,*,*,*) [real ,inout]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

Call to

utl_tmg_start(), gst_setid(), gst_gdsp(), gst_getr1snp1(), gst_speree(), utl_tmg_stop()

subroutine  calcstatsglb_mod/removemean(ensperturbations)
Purpose

Compute and subtract the ensemble mean

Arguments

ensperturbations (*,*,*,*) [real ,inout,pointer]

Called from

csg_computebhilegacy(), csg_computebhilatbands()

subroutine  calcstatsglb_mod/horizcorrelfunction(rstddev, variabletype[, wavebandindex_opt])
Purpose

Compute homogeneous-isotropic horizontal correlation function from spectral variances

Arguments
  • rstddev (nkgdimens,ntrunc)+1) [real ,in]

  • variabletype [integer ,in]

Options

wavebandindex_opt [integer ,in,]

Call to

gst_getrwt(), gst_setid(), gst_reespe(), gst_getnind(), gst_speree(), utl_abort(), write3d(), vnl_varlevelfromvarname()

subroutine  calcstatsglb_mod/write3d(gridpoint3d, filename, etiket_in, variabletype)
Purpose

Write the 3D stddev fields for all variables

Arguments
  • gridpoint3d (*,*,*) [real ,in]

  • filename [character ,in]

  • etiket_in [character ,in]

  • variabletype [integer ,in]

Call to

vnl_varlevelfromvarname(), utl_fstecr()

subroutine  calcstatsglb_mod/calchorizscale(rstddev, variabletype[, wavebandindex_opt])
Purpose

Calculate the horizontal correlation length scale

Arguments
  • rstddev (nkgdimens,ntrunc)+1) [real ,in]

  • variabletype [integer ,in]

Options

wavebandindex_opt [integer ,in,]

Call to

utl_abort(), vnl_varlevelfromvarname()

subroutine  calcstatsglb_mod/writepowerspec(powerspec, variabletype)
Purpose

Write the computed power spectrum to an ascii file

Arguments
  • powerspec (nkgdimens,ntrunc)+1) [real ,in]

  • variabletype [integer ,in]

Called from

csg_toolbox()

Call to

vnl_varlevelfromvarname()

subroutine  calcstatsglb_mod/calclocalcorrelations(ensperts)
Purpose

Compute local horizontal correlations

Arguments

ensperts [struct_ens ,in]

Call to

utl_abort(), ens_varnameslist(), gsv_allocate(), ens_getnumstep(), ens_gethco(), ens_getvco(), tim_getdatestamp(), gsv_zero(), ens_copymember(), gsv_transposetilestovarslevs(), gsv_scale(), gio_writetofile(), gsv_deallocate()

subroutine  calcstatsglb_mod/calclocalvertcorrmatrix(ensperts)
Purpose

Compute all vertical and between-variable local correlations

Arguments

ensperts [struct_ens ,in]

Called from

csg_toolbox()

Call to

fln_ensfilename(), ens_getpathname(), tim_getdatestampfromfile(), ens_varnameslist(), gsv_allocate(), ens_getnumstep(), ens_gethco(), ens_getvco(), ens_getvarnamefromk(), ens_getlevfromk(), gsv_zero(), ens_copymember(), gsv_scale(), gio_writetofile(), gsv_deallocate()

subroutine  calcstatsglb_mod/calcvertmodesspec(ensperts, vmodes)
Purpose

Compute the amplitude of the ensemble perturbations after their projection onto the vertical modes. This is the vertical equivalent of power spectra in the horizontal.

Arguments
  • ensperts [struct_ens ,inout]

  • vmodes [struct_vms ,in]

Called from

csg_toolbox()

Call to

ens_varnameslist(), gsv_allocate(), ens_getnumstep(), ens_gethco(), ens_getvco(), tim_getdatestamp(), ens_copymember(), vnl_varlevelfromvarname(), vms_transform(), gsv_deallocate(), mmpi_allreduce_sumr8_2d(), mmpi_allreduce_sumreal8scalar()

subroutine  calcstatsglb_mod/vertmodesfilter(ensperts_in, ensperts_out, vmodes, wavebandindex)
Purpose

Filter the ensemble perturbations to isolate a given vertical waveband of vertical modes.

Arguments
  • ensperts_in [struct_ens ,inout]

  • ensperts_out [struct_ens ,inout]

  • vmodes [struct_vms ,in]

  • wavebandindex [integer ,in]

Called from

csg_toolbox()

Call to

spf_filterresponsefunction(), ens_varnameslist(), gsv_allocate(), ens_getnumstep(), ens_gethco(), ens_getvco(), tim_getdatestamp(), ens_copymember(), vnl_varlevelfromvarname(), vms_transform(), ens_insertmember(), gsv_deallocate()