Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init commit for working ancil suite emulator, but without ants_src #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ancillaries/JULES/ants_lct_inputs/ancil_lct-app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[ants_decomposition]
x_split=10
y_split=10
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[ants_decomposition]
x_split=10
y_split=10

[ants_regridding_horizontal]
scheme=Linear
14 changes: 14 additions & 0 deletions ancillaries/JULES/ants_lct_inputs/grid.nl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
&grid
delta_lambda_targ=0.11,
delta_phi_targ=0.11,
global=.false.,
igrid_targ=6,
inwsw=1,
lambda_origin_targ=107.01,
lambda_pole=180.0,
phi_origin_targ=-46.58,
phi_pole=90.0,
points_lambda_targ=490,
points_phi_targ=386,
rotated=.false.,
/
51 changes: 51 additions & 0 deletions ancillaries/JULES/run_ancil_lct.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#PBS -q normal
#PBS -l ncpus=1
#PBS -l mem=4GB
#PBS -l walltime=01:00:00
#PBS -l storage=gdata/hh5+gdata/access+gdata/rp23
#PBS -l wd
#PBS -l jobfs=1GB
#PBS -P rp23

module purge
module use /g/data/access/ngm/modules
module load ants/1.1.0 # as used by Siyuan's code, also works with the RAS-based code
# module load ants/0.18 # as used in RAS

ANTS_SRC_PATH=/g/data/rp23/experiments/2024-10-10_LWG_workingbee/mjl561/ants_src/ants_1p1
ANCIL_MASTER=/g/data/access/TIDS/UM/ancil/atmos/master
INPUT_PATH=/g/data/rp23/experiments/2024-10-10_LWG_workingbee/mjl561/ants_lct_inputs
ANCIL_TARGET_PATH=/g/data/rp23/experiments/2024-10-10_LWG_workingbee/mjl561/outputs_1p1

# check if the output directory exists
if [ ! -d ${ANCIL_TARGET_PATH} ]; then
mkdir -p ${ANCIL_TARGET_PATH}
fi

# based on RAS (u-bu503) app/ancil_lct/rose-app.conf
source=${ANCIL_MASTER}/vegetation/cover/cci/v3/vegetation_fraction.nc
target_grid=${INPUT_PATH}/grid.nl
transformpath=/g/data/access/TIDS/UM/ancil/data/transforms/cci2jules_ra1.json
output_vegfrac=${ANCIL_TARGET_PATH}/qrparm.veg.frac_cci_pre_c4
output_lsm=${ANCIL_TARGET_PATH}
ANTS_CONFIG=${INPUT_PATH}/ancil_lct-app.conf

python ${ANTS_SRC_PATH}/ancil_lct.py ${source} \
--target-grid ${target_grid} --transform-path ${transformpath} \
-o ${output_vegfrac} --landseamask-output ${output_lsm} \
--ants-config ${ANTS_CONFIG}

# based on RAS app/ancil_lct_postproc_c4/rose-app.conf
ANCIL_CONFIG=${INPUT_PATH}/ancil_lct_postproc_c4-app.conf
source=${ANCIL_TARGET_PATH}/qrparm.veg.frac_cci_pre_c4.nc
target_lsm=${ANCIL_TARGET_PATH}/qrparm.mask
output=${ANCIL_TARGET_PATH}/qrparm.veg.frac_cci
c4source=${ANCIL_MASTER}/vegetation/cover/cci/v3/c4_percent_1d.nc
# c4source=/g/data/dp9/mjl561/au_ancils_source/Oceania_CSIRO_ISLSCP_C4_percent_300m.nc # high res version by Luigi

python ${ANTS_SRC_PATH}/ancil_general_regrid.py --ants-config ${ANCIL_CONFIG} \
${c4source} --target-lsm ${target_lsm} -o ${ANCIL_TARGET_PATH}/c4_percent_1d.nc

python ${ANTS_SRC_PATH}/ancil_lct_postproc_c4.py \
${source} --islscpiic4 ${ANCIL_TARGET_PATH}/c4_percent_1d.nc -o ${output}
45 changes: 45 additions & 0 deletions ancillaries/JULES/run_ancil_lct_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
author: mathew lipson [email protected]

# Purpose
This script emulates the rose/cycl suites that generate ancillaries
(e.g. vegetation fraction and land-sea mask) required to run JULES offline or
with the UM. It is based on RAS suite (u-bu503) but uses ants/1.1.0 per
Siyuan's offline code.

# Usage
from the command line: `qsub run_ancil_lct.sh`
this uses 1 cpu and takes ~ 2 mins to process this example domain

The domain is defined in `./ants_lct_inputs/grid.nl` using the same format as in the RAS.
By default the lsm mask is defined from the land cover source, however an alternative lsm
can be provided as an ancil_lct.py argument (not yet tested).

Other ANTS configuration inputs are defined in `./ants_lct_<app-name>-app.conf`, for example
the ants x/y decomposition and regridding schemes.

# Method

Uses a variety of methods and ants functionality, including
`ants.analysis.make_consistent_with_lsm`
`ants.regrid.GeneralRegridScheme` with a linear horizontal scheme

Outputs are placed by default into `./outputs_1p1` (configurable).
Following the ancillary generation suites, outputs are saved in both UM (no extension) and .nc formats.
Some files are not required at all by current versions of JULES (e.g. `qrparm.landfrac`).
Some files are only required as an intermediatory step (e.g. `qrparm.veg.frac_cci_pre_c4`, `c4_percent_1d.nc`)

The final files important for JULES are `qrparm.mask` and `qrparm.veg.frac_cci`

# Other notes

## Siyuans offline JULES ancillary suite
svn co https://code.metoffice.gov.uk/svn/roses-u/b/x/0/3/8/nci-gadi

## The land-atmos Regional Ancillary Suite (RAS)
svn co https://code.metoffice.gov.uk/svn/roses-u/b/u/5/0/3/trunk

# The RAS uses ANTS 1.0 branch:
https://code.metoffice.gov.uk/svn/ancil/ants/branches/dev/claudiosanchez/r13230_RAS_ANTS_1p0

# Siyuans ancil suite uses ANTS 1.1 branch:
https://code.metoffice.gov.uk/svn/ancil/ants/branches/dev/martinbest/r13910_ancil_ants_JULES_vn1.1.0/