An end of year update.
Things we have learnt recently.
You can’t run an ancil suite task with a domain without any land points. (This is mentioned in the ACCESS rAM3 release notes but the link to the work-around docs is broken). The ancil_lct task will run, but the downstream task ancil_lct_postprocess_c4 will fail if there are no land points. So our initial test case has moved from ocean / atmosphere only to to ocean / atmosphere+land.
We can use the ESMF conservative regridder (using the python wrapper esmpy) to correctly interpolate a regional grid and remove any edge effects. Hence we can create a MOM6 land/sea mask, regridded to the target UM resolution, that will replicate the ‘CAPS’ used by NUOPCY to transfer fluxes b/w MOM6 and the UM inside the NUOPCY executable.
The target land sea mask must have a specified co-ordinate system. Otherwise ancil_lct.py will fail at this step
tgt_crs = target_x.coord_system.as_ants_crs()
It expects the target land sea mask to have the a co-ordinate system specified in iris as
iris.coord_systems.GeogCS(6371229.0)
This can be achieved in xarray by
a) specifying a grid mapping variable
# Createa GeogCS Grid Mapping Variable
grid_mapping_var = xr.Variable(
dims=(),
data=0,
attrs={
'grid_mapping_name': 'latitude_longitude',
'earth_radius': 6371229.0,
}
)
b) referencing this variable in the attributes of the data array
da = xr.DataArray(
data=subset.data,
dims=["latitude", "longitude"],
attrs=dict(um_stash_source='m01s00i505',
grid_mapping='geog_cs',
earth_radius=6371229.0)
)
c) Including both the data array and the grid mapping variable in the output dataset
ds = xr.Dataset(
data_vars=dict(
land_binary_mask=da,
geog_cs=grid_mapping_var
),
coords=dict(
latitude=subset.latitude,
longitude=subset.longitude,
),
attrs=dict(Conventions='CF-1.7')
)
Implementing the above creates the correct vegetation cover for our regridded test domain.
Note the ancil_lct.py code converts the input float values into booleans:
lbm = lbm.copy(lbm.data.astype("bool", copy=False))
And the code sets by default
min_frac = 0.0
To do:
- Build a NUOPCY executable with both MOM6 and UM source compiled with debug flags (see above post)
- Modify
ancil_lct.py to output the actual land-sea masks used within the code, to be used by downstream ancil tasks.
- Build a task which creates a grid namelist ASCII file which replicates the land-sea mask initially defined by rMOM6 (regridded to the desired UM resolution). There are downstream tasks (e.g. ancil-cap-orog) which use the ASCII namelist file.
- Build a task and suite logic that takes the definition of the MOM6 grid and expands the domain to provide the UM ‘driving model’ domain, where the ERA5/BARRA/CMIP data is reconfigured to provide the initial and boundary conditions for the regional UM grid.