Skip to content

Conversation

@penguian
Copy link
Collaborator

The example notebook reads in the CMIP7 nitrogen forcing datasets as Iris cubes, adds the cubes, and then creates an ancillary from the resulting cube, except that is does not save the ancil file.

The notebook cannot use the /g/data/access/ngm/modules/ants modules because they use separate Singularity containers for Python.

@penguian penguian linked an issue Nov 12, 2025 that may be closed by this pull request
@penguian penguian marked this pull request as draft November 12, 2025 23:27
@penguian
Copy link
Collaborator Author

Tested with https://code.metoffice.gov.uk/trac/roses-u/browser/d/q/8/1/9/nitrogen-ozone?rev=337274
This produced a file at gadi:/g/data/tm70/pcl851/CMIP7/esm16_ancil/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2025.11.13/Ndep_1850_cmip7.anc

@penguian penguian marked this pull request as ready for review November 13, 2025 06:09
@MartinDix
Copy link
Collaborator

This file still seems to be using the input4MIPS units of kg m-2 s-1 rather than ESM 1.6 g m-2 day-1

@penguian
Copy link
Collaborator Author

OK. I will change the units to g m-2 day-1

@penguian penguian marked this pull request as draft November 14, 2025 02:37
@penguian
Copy link
Collaborator Author

Looking at the published STASH codes for NITROGEN DEPOSITION, there is a code m01s00i447 corresponding to kg m-2 s-1 but no code that corresponds to g m-2 day-1. See also https://code.metoffice.gov.uk/trac/um/wiki/STASH/ReservedCodes which also does not include a nitrogen deposition STASH code with these units.

Examining the file /g/data/vk83/configurations/inputs/access-esm1p5/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2020.05.19/Ndep_1850_ESM1.anc reveals that lbuser4=884, corresponding to a(n unpublished?) STASH code of m01s00i884.

Examining https://forum.access-hive.org.au/t/proposed-changes-to-variable-names-in-um-netcdf-conversion/4599 reveals

s03i884	_	_	NITROGEN DEPOSITION

This makes sense, since STASH section 3 refers to "boundary layer and surface".

I will change the STASH code to m01s03i884.

@penguian
Copy link
Collaborator Author

Tested with https://code.metoffice.gov.uk/trac/roses-u/browser/d/q/8/1/9/nitrogen-ozone?rev=337274
See /g/data/tm70/pcl851/CMIP7/esm16_ancil/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2025.11.14/Ndep_1850_cmip7.anc

@penguian penguian marked this pull request as ready for review November 14, 2025 05:16
@MartinDix
Copy link
Collaborator

The units used by CABLE are different to those used by MOSES/JULES so we have to ignore what the STASHmaster file says. The STASH code in the ancillary file has to be m01s00i447, using the code for the section 3 diagnostic field won't work.

Fix for um2nc ACCESS-NRI/um2nc-standalone#208

@penguian
Copy link
Collaborator Author

I spoke to Spencer. See https://github.com/ACCESS-NRI/access-esm1.6-configs/blob/dev-preindustrial%2Bconcentrations/atmosphere/prefix.PRESM_A lines 711-715:

1|    1 |    0 |  884 |NITROGEN DEPOSITION                 |
2|    2 |    0 |    1 |   21 |    5 |   -1 |   -1 |    0 |    0 |    0 |    0 |
3| 000000000000000000000000000000 | 00000000000000000001 |    3 |
4|    1 |  122 | -99  -99  -99  -99  -99  -99  -99  -99  -99  -99 |
5|    0 | 1510 |    0 |  129 |    0 |    0 |    0 | 9999 |    0 |

This agrees with the output of mule-pumf for /g/data/vk83/configurations/inputs/access-esm1p5/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2020.05.19/Ndep_1850_ESM1.anc, so the correct SASh code is m01s00i884, and the units for STASH code m01s00i447 do not need to be changed.

@penguian
Copy link
Collaborator Author

Output is in /g/data/tm70/pcl851/CMIP7/esm16_ancil/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2025.11.18/Ndep_1850_cmip7.anc

$ mule-cumf --stashmaster 7.3 /g/data/vk83/configurations/inputs/access-esm1p5/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2020.05.19/Ndep_1850_ESM1.anc /g/data/tm70/pcl851/CMIP7/esm16_ancil/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2025.11.18/Ndep_1850_cmip7.anc|more
/g/data/xp65/public/apps/med_conda/envs/analysis3-25.09/lib/python3.11/site-packages/mule/validators.py:198: UserWarning: 
File: /g/data/vk83/configurations/inputs/access-esm1p5/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2020.05.19/Ndep_1850_ESM1.anc
Ancillary file contains header components other than the row/column dependent constants - these should be set to "None" for Ancillary files
  warnings.warn(msg)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* (CUMF-II) Module Information *
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mule       : /g/data/xp65/public/apps/med_conda/envs/analysis3-25.09/lib/python3.11/site-packages/mule/__init__.py (version 2024.11.1)
um_utils   : /g/data/xp65/public/apps/med_conda/envs/analysis3-25.09/lib/python3.11/site-packages/um_utils/__init__.py (version 2024.11.1)
um_packing : /g/data/xp65/public/apps/med_conda/envs/analysis3-25.09/lib/python3.11/site-packages/um_packing/__init__.py (version 2024.11.1) (packing lib from SHUMlib: 2024111)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* CUMF-II Comparison Report *
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

File 1: /g/data/vk83/configurations/inputs/access-esm1p5/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2020.05.19/Ndep_1850_ESM1.anc
File 2: /g/data/tm70/pcl851/CMIP7/esm16_ancil/modern/pre-industrial/atmosphere/land/biogeochemistry/global.N96/2025.11.18/Ndep_1850_cmip7.anc
Files DO NOT compare
  * 11 differences in fixed_length_header (with 7 ignored indices)
  * 1 differences in integer_constants (with 0 ignored indices)
  * 0 differences in level_dependent_constants (with 0 ignored indices)

Compared 0/24 fields, with 0 matches
12 fields found in file 1 were not in file 2
12 fields found in file 2 were not in file 1

%%%%%%%%%%%%%%%%%%%%%%%
* fixed_length_header *
%%%%%%%%%%%%%%%%%%%%%%%
Components DO NOT compare (compared 249/256 values)
Ignored indices:
  Index 35 (t3_year)
  Index 36 (t3_month)
  Index 37 (t3_day)
  Index 38 (t3_hour)
  Index 39 (t3_minute)
  Index 40 (t3_second)
  Index 41 (t3_year_day_number)
Component differences:
  Index 21 (t1_year)                          differs - file_1:      0  file_2:   1850
  Index 24 (t1_hour)                          differs - file_1:      0  file_2:     12
  Index 27 (t1_year_day_number)               differs - file_1:      0  file_2: -32768
  Index 28 (t2_year)                          differs - file_1:      0  file_2:   1850
  Index 31 (t2_hour)                          differs - file_1: -32768  file_2:     12
  Index 34 (t2_year_day_number)               differs - file_1:      0  file_2: -32768
  Index 110 (level_dependent_constants_start) differs - file_1:    278  file_2: -32768
  Index 111 (level_dependent_constants_dim1)  differs - file_1:      1  file_2: -32768
  Index 112 (level_dependent_constants_dim2)  differs - file_1:      4  file_2: -32768
  Index 150 (lookup_start)                    differs - file_1:    282  file_2:    278
  Index 161 (data_dim1)                       differs - file_1: 172032  file_2: 337920
...

@MartinDix
Copy link
Collaborator

Looks good now. See #93 (comment)

I was thrown for a while by the 1850 differences between 1-1 and 1-2.

Copy link
Collaborator

@atteggiani atteggiani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Paul. Looks good.
I left a couple small comments.

@penguian penguian requested a review from atteggiani November 20, 2025 00:24
@penguian penguian merged commit 14f8a23 into main Nov 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nitrogen examples

4 participants