Segmentation error when using xancil to create smow ancillary

Hi NCAS CMS,

I’m trying to create a global smow ancillary file, however when I run xancil on the following job, /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC/smow_initial_20210409T0000Z.job, I get a segmentation error. I have tried running the xancil module through the serial and standard queues (see /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC/create_initial_SM_ancil.pbs as an example).

My aim is to initialise an ERA5-driven regional simulation with operational UM soil moisture conditions. The surface is too dry if you rely on ERA5 soil moisture. As I’m external to the Met Office, and I can’t access OISTA, I’m trying to create my own soil moisture ancillary file which will be downscaled during reconfiguration.

Any ideas how I can get passed this segmentation error?

Kind regards,
Josh

Hi Josh

Try running this before you run xancil

ulimit -Ss 40000

For future reference:

Problem was because of code to rotate longitude values to be 0-360, if arrays are too large cshift will give a Segmentation fault. If you increase stack size via ulimit -Ss 40000 the code will run. Array size in this case was 2560x1920.

1 Like

Hi Jeff,

Thanks for the prompt response. Using ulimit -Ss 40000 enabled me to run xancil for an N1280 file.

My latest issue: When using xancil to produce a smow ancillary file, it flips the latitudes so they read South to North (-90 to 90) rather than North to South (90 to -90). This doesn’t work with smcsnow_anc which calls the CENTRAL ANCILLARY FILE CREATION PROGRAM and expects North to South data. I think what is happening is the program takes the start lat and subtracts the lat grid spacing to define the source grid latitude points. As the starting latitude point is -90ish (because xancil saves -90 to 90), the lat points go from -90 to -270. Then the program says, no lat points defined on source grid given (i.e. the ancil file which runs from -90 to 90), so calls a climatological file (which I don’t want!).

Do you know how I can use xancil to ensure the starting latitude is just below 90 degress (i.e. run North to South)? I have tried various versions and grid configurations (i.e. old dynamics, new dynamics etc.) using xancil, however the central_ancillary.exe then doesn’t like the defined soil moisture levels or can’t read in four SM levels. I have tried using mule to change the starting latitude point, however mule doesn’t let me save an ancillary file with LEVEL HEADER COMPONENTS. When removing these, central_ancillary.exe can’t recognise the individual SM levels. I also tried xconv to flip latitude points, however xconv can’t save a MetUM file.

The whole point of this exercise, is to have the ability to give the UM any N1260 soil moisture field which it can then bi-linearly interpolate onto a much finer resolution (i.e. 4km). The interpolation will also take into consideration lakes and coastlines in the appropriate UM manner.

/work/n02/n02/jostal/cylc-run/u-dc369/log/job/20210409T0000Z/EastAfrica_38p5L80_4p4km_ancil_smcsnow/ - contains Friday’s attempts on running ancil_smcsnow. /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC/smow_initial_20210409T0000Z_n1280_clim.job contains the xancil job file, whilst smow_initial_20210409T0000Z_ancil_n1280 is the latest ancil file.

Hope you can help.

Josh

Hi Josh

The problem is xancil is designed to provide files for the UM not the CAP, which as you can see needs different files to what the UM needs.

The only way xancil will produce files with latitudes North to South is to set UM model version number to 4.5 and Select atmosphere grid, Based on model dynamical core to Old Dynamics. But I guess you tried this and it didn’t work? If so then I would say xancil is the wrong tool for the job.

Jeff.

Hi Jeff,

Ummmm okay. I will try and run with a UM file from that xancil configuration. If it fails, do you have any recommendations regarding appropriate software to produce ancil file for CAP. Can CAP read netcdf files?

Kind regards,
Josh.

Hi all,

I’m moving onto using ANTS to regrid soil moisture data to the 4km domain. First issue, how do I get access to rdf_migrate group workspace on JASMIN?

Josh

Hi all,

No luck creating the soil moisture data I am looking for.

Essentially, is there any documentation which describes how soil moisture is interpolated from an astart file to a high-resolution nested domain?

I’ve tried bi-linear interpolation, through using either IRIS and ANTS (general_regrid.py), however when comparing bi-linear interpolation of initial SM with the initial SM outputted from a simulation initiated from an astart file, I get differences of up to +/- 5 kg m-2 for top layer (see photo below).

The goal is to initialize a nested UM simulation with ERA5 data but using initial soil moisture from the Met Office. It would be helpful to know how initial SM is treated from a starting dump file to initialise a MetUM simulation? Relying on ERA5 SM leads to a too dry surface!

Kind regards,
Josh

Hi all,

I’ve made substantial progress with developing my own “reconfiguration” of initial soil moisture data. Essentially, I’m developing a process with which I can take initial soil moisture from the Met Office, interpolate the data onto my chosen grid, and then initialise a simulation with that starting soil moisture. The purpose of this is to enable UKCEH to have the capability of performing MetUM simulations on ARCHER with ERA5 boundary conditions without the reliance on OISTA (didn’t get very far using this outside of MO).

To interpolate soil moisture, I had to convert soil moisture content into soil moisture stress. Then I applied a linear interpolation using ANTS which included spiral method 3? for coastline adjusting. After converting interpolated soil moisture stress to soil moisture content, I am left with the following difference between initial soil moisture from a simulation initialized from a MO dump file and my calculated soil moisture. My errors are largest (up to 10 g kg-1) around coastlines. This suggests an issue with ANTS regridding but I can’t make out the issue. My code for re-configuring initial n1280 SMC from the MO to, in this case, a 4.4km resolution can be found at /work/n02/n02/jostal/prescribed_SM_files/initial_MO_SMC_v2/SM_SMSTRESS_ants_regrid.slurm.

I’m tempted to continue with these soil moisture errors, but I thought I would check whether anyone has any idea what could be wrong?

Very close to UKCEH having the capability of running limited-area simulations bounded by ERA5 with soil moisture values appropriate for the MetUM.

Kind regards,
Josh

Hi Josh
Just a guess. That plot is a difference plot between another model and your model, right? Maybe the different values for the coastline grid cells is due to a difference in how the land fraction is used or estimated?
Patrick

Hi Patrick,

Thanks for the response. I’m using the same landmask field for both my operation and the Met Office’s conversion from initial dump to start file.

Can I quickly ask, is there an option in ANTS which would do the following:

B.3 Stage One : resolved coastal points
To identify the field value to use for a resolved coastal point the algorithm considers the weights that would be used by bi-linear interpolation for the four source points alongside the type of the four points as given by the mask being used. The algorithm selects the point of the desired type that has the largest interpolation weight. This is considered equivalent to being the nearest point of the correct type. In essence, this method makes no adjustment for the variation in grid lengths due to change in latitude, much less for any change in a variable resolution grid. The upside of doing this is that it is a cheap and quick comparison to make. The variation in result should the true nearest point be found is deemed negligible

This came from https://code.metoffice.gov.uk/doc/um/latest/papers/umdp_S11.pdf and I don’t know how to code this up using ANTS.

Kind regards,
Josh

Hi Josh:
That idea in the umdp_S11.pdf file sounds promising, but I don’t know how to do it in ANTS.
Patrick

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

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