UM_Bristol

Back to HadCM3_user_notes

Documentation for useful tools

Introduction

When interacting with models and model results, some tools are useful for visualising (e.g., xconv, panoply), some tools are useful for downloading files (e.g., ftp_master), and some tools are useful for configuration/ancillary manipulation (e.g., xancil, isla).

A quick rule of thumb:

If you are on the newer Rocky-8 BRIDGE machines, most software is provided via environment modules:

For X11 forwarding from macOS:

xconv

https://ncas-cms.github.io/xconv-doc

Xconv is a point-and-click X-windows application widely used to inspect and quickly plot UM PP fields and netCDF. It’s particularly handy for “sanity checking” fields (are values sensible? missing values? time axis?) and for quick regridding/output conversion to netCDF for downstream analysis.

How to access

Basic tips / quick workflow

Common gotchas

Where to get advanced tips

xancil

https://ncas-cms.github.io/xancil-doc/singlehtml/index.html

Xancil is an X-windows application for creating UM ancillary files (e.g., land surface / emissions / climatologies) from netCDF inputs. It’s commonly used when you have prepared a netCDF on a UM-compatible grid and need a UM ancil for the model.

How to access

Basic tips (what to prepare before opening xancil)

Common gotchas / troubleshooting

Where to get advanced tips

panoply

https://www.giss.nasa.gov/tools/panoply/

Panoply is a desktop GUI for exploring and plotting netCDF/HDF/GRIB data. It’s great for quick-look plotting of netCDF outputs (including those produced by um2nc, xconv, or post-processing pipelines) without writing any code.

How to access

Basic tips

Where to get advanced tips

cdo

https://code.mpimet.mpg.de/projects/cdo https://code.mpimet.mpg.de/projects/cdo/embedded/index.html

CDO (Climate Data Operators) is a fast command-line toolbox for common climate/data operations on netCDF/GRIB: temporal means, spatial remapping, subsetting, merges, arithmetic, climatologies, etc. It’s ideal for batch processing near the data (BRIDGE/HPC).

How to access

Basic tips / common commands

Common gotchas

Where to get advanced tips

ftp_master

ftp_master is a BRIDGE-specific command used to download experiment output from a remote machine (commonly the University HPC) onto BRIDGE storage, and (in typical configurations) convert outputs into netCDF as part of the transfer workflow. It is often used tidy_expt (finalise/copy remaining files and clean up).

How to access

Basic usage patterns

Where the data ends up / how to find it

Common gotchas

Where to get advanced tips

utils_cmip7

https://github.com/Climateyousheng/utils_cmip7

utils_cmip7 is a Python toolkit for carbon cycle analysis from UM climate model outputs. It handles the full workflow from raw UM output files to validated results against CMIP6 and RECCAP2 observations.

How to install

git clone https://github.com/Climateyousheng/utils_cmip7.git
cd utils_cmip7
pip install -e .

Requirements: Python >= 3.8, numpy, pandas, matplotlib, iris, cartopy, xarray, cf-units, netCDF4 (all installed automatically with pip install -e .).

Input data

The toolkit works with two types of input:

Option A: Pre-processed annual mean NetCDF files (recommended, faster) Located in ~/annual_mean/{expt}/:

Generate these from raw output using:

./annual_mean_cdo.sh "xqhuj" ~/annual_mean pt pd pf

Option B: Raw monthly UM files Located in ~/dump2hold/{expt}/datam/, matching pattern {expt}a#pi00000{YYYY}{MM}+.

STASH code mappings

The toolkit centralises STASH code mappings so you don’t need to remember them:

Variable STASH (PP) STASH (NC) Description
GPP m01s03i261 3261 Gross Primary Production
NPP m01s03i262 3262 Net Primary Production
Rh m01s03i293 3293 Soil respiration
CV m01s19i002 19002 Vegetation carbon
CS m01s19i016 19016 Soil carbon
fracPFTs m01s19i013 19013 PFT fractions
fgco2 m02s30i249 30249 Ocean CO2 flux
tas m01s03i236 3236 Surface air temperature
pr m01s05i216 5216 Precipitation

Unit conversions are applied automatically (e.g. kgC/m2/s to PgC/yr for fluxes, kgC/m2 to PgC for stocks).

Basic usage

Extract annual means from pre-processed NetCDF:

from utils_cmip7 import extract_annual_means
ds = extract_annual_means(expts_list=['xqhuc'])

# Access data
gpp = ds['xqhuc']['global']['GPP']
print(f"GPP: {gpp['data']} {gpp['units']}")

# Extract specific regions
ds = extract_annual_means(['xqhuc'], regions=['global', 'Europe', 'Africa'])

Extract from raw monthly UM files:

from utils_cmip7 import extract_annual_mean_raw
data = extract_annual_mean_raw('xqhuj', start_year=1850, end_year=1900)

Scripts

extract_preprocessed.py — Extract annual means for all RECCAP2 regions (global + 10 regions) and generate time series plots:

python scripts/extract_preprocessed.py xqhuc

Outputs to validation_outputs/single_val_{expt}/: a CSV of time-mean values plus per-region time series plots for carbon fluxes, stocks, climate variables, and PFT fractions.

extract_raw.py — Extract from raw monthly files:

python scripts/extract_raw.py xqhuj --outdir ./plots

validate_experiment.py — Three-way validation (UM vs CMIP6 vs RECCAP2):

python scripts/validate_experiment.py xqhuc

Outputs to validation_outputs/single_val_{expt}/:

CLI commands (experimental)

utils-cmip7-extract-raw xqhuj
utils-cmip7-extract-preprocessed xqhuc
utils-cmip7-validate-experiment xqhuc
utils-cmip7-validate-ppe

Common gotchas

Back to HadCM3_user_notes