Hi all,
This may be of interest to anyone who hopes to regrid soil moisture content (SMC) and create a soil moisture ancillary. It is NOT as simple as running bilinear interpolation using IRIS for example.
Currently initial soil moisture from a recent MetUM dump file is at an N1280. When running a 4 km horizontal resolution simulation, for instance, the UM will configure initial soil moisture to the desired resolution. There are essentially three parts to the UM’s configuration of soil moisture: (1) convert soil moisture content (SMC) to soil moisture stress; (2) horizontal bilinear interpolation with coastal adjustments; and (3) conversion back from soil moisture stress to SMC with additional checks.
(1): Convert SMC to soil moisture stress as the reconfig for the UKMO interpolates soil moisture stress and NOT SMC. /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC_v2/SM_to_SMSTRESS.slurm is an example sbatch script which calls SMC_to_stress.py under an python virtual environment (/work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC/regrid_SMC_env/). The python script is based on rcf_smc_stress_mod.F90 (https://code.metoffice.gov.uk/trac/um/browser/main/trunk/src/utility/qxreconf/rcf_smc_stress_mod.F90).
(2): Once converting to soil moisture stress, you can now interpolate onto the new grid. I do this on JASMIN using /gws/nopw/j04/nzplus/3C/task_2/jostal/TJ_idealised_study/MO_SM_start_files/generate_weights_landsea_gridding.py. The script performs bilinear interpolation using xesmf. After bilinear interpolation, two considerations needed to be taken for coastal points: (a) resolved and (b) unresolved coastal points (discussed in section B.3 of https://code.metoffice.gov.uk/doc/um/latest/papers/umdp_S11.pdf). For resolved coastal points (a), I loop through points which appear extremely large due to interpolating with bad ocean values. I find the nearest land point for each large value and 100% weight the value by that nearest land source grid point. After looping four times, I essentially ensure that I take the nearest land point and a sensible soil moisture value is outputted. Following this process for resolved coastal points, I then move onto unresolved coastal points (b) with which I use the ANTS make_consistent_with_lsm function (https://code.metoffice.gov.uk/doc/ancil/ants/latest/lib/ants.analysis.html#ants.analysis.make_consistent_with_lsm). This applies a spiral circle method.
(3): After this interpolation, you will need to convert soil moisture stress back to SMC. An example sbatch script is /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC_v2/SMSTRESS_unres_coastadj_to_SM.slurm. The conversion of soil moisture stress to SMC is based on https://code.metoffice.gov.uk/trac/um/browser/main/trunk/src/utility/qxreconf/rcf_soilstress_to_soilmoist_mod.F90). After converting SMC, there are several checks which can be found in https://code.metoffice.gov.uk/trac/um/browser/main/trunk/src/utility/qxreconf/rcf_soil_moist_chk_mod.F90.
The photo below shows minimal errors between initial soil moisture when comparing reconfiguration performed by the Met Office and that performed using the process above. It would be good if ANTS had the capability to compute resolved coastal points (2a). At the moment the regridding function on ANTS will treat all coastal points using a spiral circle (https://code.metoffice.gov.uk/doc/ancil/ants/latest/_modules/ancil_general_regrid.html#main), whilst the UM will compute resolved coastal points (100% weighting of nearest land point) and then perform spiral circle method for unresolved coastal points. Happy to support improvement in ANTS.
Thanks for everyone’s thoughts. I plan to make the code more streamline when I find the time!
Josh