gcpy.examples.diagnostics.compare_diags

Example script that can compare diagnostics from two different netCDF collections. Similar to compute_diagnostics.ipynb, but can be used without having to open a Jupyter notebook. The parameters for the configuration are specified in a YAML file whose name is passed as an argument.

Examples

  1. Copy the compare_diags.yml file to a different folder

  2. In your copy of compare_diags.yml, edit labels, file paths, etc. for the Ref and Dev versions. Also select the types of output that you desire.

  3. Run the following commands:

$ conda activate gcpy_env
(gcpy_env) $ python -m gcpy.examples.diagnostics.compare_diags \
             /path/to/yaml/file

Functions

compare_data(config, data)

Compares data from two different xarray datasets.

create_dirs(config)

Create directories for plots and weights if they do not exist.

main(argv)

Main program, reads data and calls compare_data to make plots.

print_totals_and_diffs(config, refdata, ...)

Prints totals and differences of data.

read_data(config)

Read data from the Ref and Dev datasets.

gcpy.examples.diagnostics.compare_diags.create_dirs(config)[source]

Create directories for plots and weights if they do not exist.

Parameters:

config (dict) – Configuration information read from a YAML file.

gcpy.examples.diagnostics.compare_diags.read_data(config)[source]

Read data from the Ref and Dev datasets.

Parameters:

config (dict) – Configuration information read from a YAML file.

Returns:

data – Contains Ref and Dev data as xarray Dataset fields.

Return type:

dict

gcpy.examples.diagnostics.compare_diags.print_totals_and_diffs(config, refdata, devdata, varlist)[source]

Prints totals and differences of data. This is a quick way to see if there are nonzero differences between Ref and Dev datasets.

Parameters:
  • config (dict) – Configuration information read from a YAML file.

  • refdata (xarray.Dataset) – Contains data from the Ref model run.

  • devdata (xarray.Dataset) – Contains data from the Dev model run.

  • varlist (list of str) – Contains a list of data variables.

gcpy.examples.diagnostics.compare_diags.compare_data(config, data)[source]

Compares data from two different xarray datasets.

Parameters:
  • config (dict) – Configuration information read from a YAML file.

  • data (dict) – Contains Ref and Dev data as xarray Dataset fields.

gcpy.examples.diagnostics.compare_diags.main(argv)[source]

Main program, reads data and calls compare_data to make plots.