Using xancil and xconv to create timeslice ancillary files

Hi,

I’m trying to create a 2050 timeslice ancillary for land cover from the SSP370 model derived land cover ancil file on Archer2 but I’m having some trouble using xancil0.58.

On Archer 2 I copied the model-derived ancils from /work/y07/shared/umshared/cmip6/ancils/model_derived/ukesm1.0_ssp370_r2i1p1f2_u-be690/n96e/timeseries_2015-2100/vegetation into my own directory (/work/n02/n02/jweber/Ancils/ssp370/Vegetation_and_Land_Use). I used xconv to open u-be690_m01s00i216_2015-2100_monthly_timeseries_land_cover_frac.anc.nc, selected the 12 months of 2050 and output this as a NetCDF file (Land_Cover_216/Land_Cover_216_ssp370_2050.nc).

Both the model derived .anc.nc file and my 12-month timeslice have 27 “z levels” which makes sense as the original SSP370 run (u-be690) was run with 13 PFTs and 14 non-plant surface types. I then tried to convert Land_Cover_216_ssp370_2050.nc to an ancil file format using xancil. I updated the UM version to 11.1 and in Grid Configuration I selected “Use input NetCDF variables to specify pseudo levels”. I also specified 27 pseudo levels in the Vegetation Fraction section. The output .anc file (Land_Cover_216_ssp370_2050_v2.anc) does have 27 pseudo levels but the numerical output is clearly wrong being composed of either 0 or 1e20.

I’m aware that 14 of the surface types included in the input .nc file are non-vegetation (i.e. soil, ice, water, urban etc) but I can’t see any other way to make a Land Cover .anc file. I also note that the original model-derived .anc file (u-be690_m01s00i216_2015-2100_monthly_timeseries_land_cover_frac.anc) only has 5 pseudo levels while its .anc.nc counterpart has 27 - I don’t know if this is important or merely incidental.

Would you have suggestions about where I am going wrong?

Many thanks for your help,

James

I should also add that the time dimension of the output file is being lost (input .nc file has 12 time steps, output .anc files has 1) and the time value is also being wiped (input has timestamp of year 2050 and input has timestamp 0000/01/01).

James

Hi James

I don’t have permission to read your files on archer2, can you run these commands to fix this

chmod -R g+rX /work/n02/n02/jweber
chmod -R g+rX /home/n02/n02/jweber

Thanks.

Jeff.

Thanks, Jeff, I’ve run that command.

James

Hi James

Thanks for doing that. It would be helpful if you could setup xancil again and save a job file, using the buttons at the bottom. This way I can see how you configured xancil and it makes it easy for you to repeat your configs.

Your data looks to be correct (I think) but the value of 1e20 is stopping the smaller values being seen. This number is used as a missing data value in xconv but shouldn’t be used by xancil, I’m not sure why this is happening.

This is a problem with xconv not being able to read the anc file correctly, it does actually have 27 pseudo levels. Xconv wants to use the pseudo levels as a vertical dimension but the pseudo level values are not monotonically increasing and this confuses xconv.

There is more to do to get this right but it would be useful to see the job files first.

Jeff.

Hi Jeff,

Thank you. I have repeated the xancil setup outlined before and saved the job as Land_Cover_216/Specimen_job.job and the .anc output as Land_Cover_216/Land_Cover_216_ssp370_2050_v4.anc (looks the same as the previous file …v2_.anc).

Thanks for clarifying the xconv pseudo level issue with .anc. It is helpful to know that both .anc and .anc.nc actually have 27 pseudo levels as all the model suites which I have seen using this setup have used the .anc files (rather than the .anc.nc files). Is there a better way to look at .anc files?

Cheers,

James

Hi James

The problem with the large value 2e20 was because you did not select Use missing data value to calculate sea mask in the Vegetation Fractions panel.

But using the Vegetation Fractions panel will not work as it does not allow the data to have multiple times, you will need to use the Generalised Ancillary Files option to do this. I have created a job file which does this, see

/work/n02/n02/jwc/helpdesk/311/Land_Cover_216_ssp370_2050.job

There is one problem with the anc file created, the pseudo level values are wrong, you can see them in the Grid Configuration panel. They need to be the same values as in file u-be690_m01s00i216_2015-2100_monthly_timeseries_land_cover_frac.anc.nc

pseudo_level = 101, 102, 103, 201, 202, 3, 301, 302, 4, 401, 402, 501, 502, 6, 7, 8, 9, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910 ;

You will need to enter these into xancil by hand.

Did you want the anc file to be a 1 year time series or did you want it to be periodic? Select the right option in xancil.

Hopefully this will give you a working ancil file.

You could maybe try IRIS to look at ancil files, or use mule to convert it to netCDF. I’ve not tried either of these so can’t say if it will work.

Jeff.

Hi Jeff,

Many thanks, I followed your advice and have produced an .anc file.

The ancils will be used in timeslice UKESM simulations so I have specified they will be periodic in time.

When I open the new .anc file (Land_Cover_216_ssp370_2050_v5.anc) in xconv I note that it shows 5 pseudo levels (like the .anc file from u-be690) but in the corresponding namelist file (v5_xancil.namelist) I can see 27 pseudo levels with the correct values. I also note the .anc file shows 48 timesteps (2050-2053) in xconv while the input .nc file had just 12. I wonder if this is also an xconv issue as v5_xancil.namelist shows IGENANC_NTIMES(1) = 12 which I interpret to mean the .anc has 12 timesteps (as it should).

Finally, would you recommend specifying the ancillary file dates in Grid Configuration? I note that when it is not specified, the start year in namelist file is 0000. I don’t know if the correct time is a requirement for UKESM.

Thanks,

James

Hi James

Glad you managed to get an ancillary file, hopefully the UM will like it.

You can’t trust anything xconv says about these files it gets confused about what is a vertical dimension and what is a time dimension because of the pseudo levels values. The file will have 27 pseudo levels and 12 time values.

You can use cf-python to convert this file to netcdf and then you should be better able to look at it, xconv handles non-monotonically increasing vertical levels better in netcdf format. To convert the file you need to setup cf-python and run a script

export PATH=/home/n02/n02/ajh/miniconda3/bin:$PATH
python um2nc_cf.py  Land_Cover_216_ssp370_2050_v5.anc

You can find um2nc_cf.py in directory /work/n02/n02/jwc/helpdesk/311

If you don’t specify the start dates they are read from the netcdf file, the values in the namelist file won’t be used. For annual periodic data the value of the year isn’t important.

Jeff.

Hi Jeff,

Thank you. When running the script (after running “module load cray-python”), I get:

File “um2nc_cf.py”, line 2, in
import cf
File “/work/n02/n02/jweber/.local/lib/python3.8/site-packages/cf/init.py”, line 133, in
import cfunits
File “/work/n02/n02/jweber/.local/lib/python3.8/site-packages/cfunits/init.py”, line 46, in
from .units import Units # noqa: F401
File “/work/n02/n02/jweber/.local/lib/python3.8/site-packages/cfunits/units.py”, line 41, in
raise FileNotFoundError(
FileNotFoundError: cfunits requires UNIDATA UDUNITS-2. Can’t find the ‘udunits2’ library.

I have looked at the UDUNITS documentation (including the comments on Installation — Documentation) but can’t work out how to solve this. I’m sorry for going away from the original topic but do you know of anyone else who’s had this problem with cf-python on Archer2? It would be great tool to have if I can get it working.

Best,

James

James

Please try

export PATH=/home/n02/n02/dch/cf/bin:$PATH
python um2nc_cf.py  Land_Cover_216_ssp370_2050_v5.anc

Grenville

Thanks, Grenville.

At first this generated:

File “/work/n02/n02/jweber/.local/lib/python3.8/site-packages/cfunits/units.py”, line 225, in
assert 0 == _ut_unmap_symbol_to_unit(_ut_system, _c_char_p(b"Sv"), _UT_ASCII)

I checked the CF python documentation and found this error message could be solved by specifying the location of the udunits2.xml file. (export UDUNITS2_XML_PATH=/work/n02/n02/jweber/udunits-2.2.28/lib/udunits2.xml)

After I did that (and without running module load cray-python), the script worked and generated the desired .nc file.

Many thanks for your help,

James