Introduction

The purpose of this set of modules is to implement horizontal 1- and 2-dimensional spatial filtering of 2- and 3- dimensional output from MONC (and similar data), as well as 1D power spectra from 2D fields.

Filtering

This notionally corresponds to a split of a variable:

\phi = \phi^r + \phi^s

Note that this is not the same as coarse graining; the ‘resolved’ field \phi^r has the same number of gridpoints as the original, it is just smoother (with one exception noted below).

The code also produces ‘subfilter’ fluxes, variances and covariances: for any pair of variables \phi,\psi:

s(\phi,\psi) = (\phi\psi)^r - \phi^r\psi^r.

Power Spectra

The Power Spectra computed are conventional 2D power spectra averaged either in x- or y-direction, or radial spectra averaged around the azimuthal direction. Care has been taken to normalise in using standard and corrections can be applied to the radial spectra. See Durran et al. (2017) for details.

Output Files

An important feature of the code is that it creates two types of derived files.

  • A single file containing intermediate data such as \theta_L interpolated to the required grid, stored at variable th_L_on_w in NetCDF. This must be setup by the user using setup_derived_data_file(). The user must tell the code to use it by setting options['save_all'] = 'Yes'. The file name is created from arguments destdir, source_file and fname.

  • A file for each filter containing filtered variables and sub-filter counterparts. This must be setup by the user using setup_filtered_data_file(). The file name is created from arguments destdir, source_file, fname and filter_def.id.

Variable Names

This package uses xarray - returned variables are xarray DataArrays. These have names; this package follows the following naming convention.

  • Filtered variables obtained using filter_field() or filter_variable_list() are retrieved from the filtered variables file if present or calculated and stored therein if not. Data are returned as two variables, named f(x)_r and f(x)_s, the ‘resolved’ and ‘sub-filter’ parts of variable x, with x including the grid specification (e.g. u_on_w) if filter_variable_list() is used.

  • Filtered products of pairs of variables obtained using quadratic_subfilter() or filter_variable_pair_list() are retrieved from the filtered variables file if present or calculated and stored therein if not. Data are returned as s(x,y)_on_g, where x and y are the two variables and g is the requested output grid. If filter_variable_pair_list() is used with options['save_all'] set to 'yes', the variables x_on_g.y_on_g, f(x_on_g.y_on_g)_r and f(x_on_g.y_on_g)_s are also saved.

Filters

A number of filters have been implemented, currently
  1. Gaussian.

  2. Spectral wave cutoff.

  3. Spectral cylindrical wave cutoff.

  4. Running mean (or ‘top-hat’).

  5. 2D version of the 1-2-1 filter.

  6. For completeness, a ‘whole domain’ filter in which the resolved field is the horizontal domain average. In this case the resolved field has no horizontal dimensions.

An example of use can be found in examples/subfilter_file.py.

Dependencies

At Version 0.6 the repository was split - please ensure https://github.com/ReadingClouds/monc_utils.git is also installed.

Version History

Latest version is 0.6.0