In QGIS 3.28 I have layers with a user defined projection. It is simply Transverse Mercator with a custom central meridian. It shows up as EPSG:10000.
Predictably, $area calculations return NaN.
If I use Project Properties > CRS and manually specify EPSG:32734 as the project CRS, OTF transforms do their thing and I am able to calculate $geometries and items relying on the CRS in the layout.
HOWEVER, if I attempt to achieve this via the Python console, Processing toolbox or similar, using the following command:
crs = QgsCoordinateReferenceSystem("EPSG:32734")
QgsProject.instance().setCrs(crs)
The correct EPSG code is displayed in the bottom right and if I check Project>CRS, it shows UTM34S as the selected project CRS but none of the $geometry calculations work, the scale bar in the print layout is wrong.
The map coordinates change to what they should be and on the surface, the new CRS is being used but I still cannot derive an $area calculation.
I cannot fathom what is happening.
EDIT: This is the .prj string:
PROJCS["Transverse_Mercator",
GEOGCS["GCS_WGS_1984",
DATUM["D_WGS84",
SPHEROID["WGS84",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["false_easting",0.0],
PARAMETER["false_northing",0.0],
PARAMETER["central_meridian",27.0],
PARAMETER["scale_factor",1.0],
PARAMETER["latitude_of_origin",0.0],
UNIT["Meter",1.0]]