Modifying existing ancillary file using iris

Dear Helpdesk,

my current approach to making ancillaries is to convert the ancillary to netcdf then manipulate it using xarray, write out the modified data as netcdf and then convert to an ancillary file using xancil. This is a bit of a faff as I need to run xancil.

iris looks like it can read ancillary files, and then they can be modified. Is there a way of writing out ancillary files from iris? The documentation suggests iris can write out pp or netcdf data. I don’t think ancillary files are pp but some related format…

So is there a way of writing ancillary files using iris?

Can version 13.8 of the UM read ancillary files that are netcdf?

Simon

SImon

ANTS can write ancillary files (we have very little experience with it):

https://code.metoffice.gov.uk/doc/ancil/ants/latest/lib/ants.io.html#module-ants.io.save

UM 13.8 does not read netcdf ancil files.

Grenville

Thanks Grenville,

ants does not live in the default jaspy environment on jasmin so I think I will avoid using it. Instead, I will use iris to read the ancillary file, write it out as netcdf and use xancil to convert it. xancil is also not in the default env on jasmin. Does it exist on jasmin?

For now, I’ve transferred the netcdf file from jasmin to archer2 and used xancil there…

Simon

I don’t have any example scripts for this, but mule is also a powerful tool for directly manipulating UM (dump, field-file, pp, ancils) format files.

Welcome to Mule’s documentation — Mule API documentation

This is used in the postproc tasks for GA/UKESM suites and looking at the job scripts, on ARCHER2 the library can be imported in python after:

. /work/y07/shared/umshared/bin/rose-um-env-puma2
module load cray-python gct

At its core I think the data is a numpy array so other libraries can be used to manipulate.

Mohit

Thanks a lot Mohit,

is there an easy way for mule to work with iris or xarray? It looks like I would need to get the data parts of those objects and stuff them into a mule object…

Simon

I have mostly used this for header manipulation rather than data, but depending on what operation you want to perform on a field from an existing ancillary, you should be able to add an operation on the numpy data array using Xarray or Iris in the ‘transform’ method of a DataOperator class and write out to a different ancil e.g. as shown here:

https://code.metoffice.gov.uk/doc/um/mule/2024.11.1/examples_data.html#example-2-set-level-1-u-fields-stash-code-2-to-their-absolute-values

Hi Simon

Xancil is available on jasmin under my account.

/home/users/jcole/bin/xancil

Jeff.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.