Did you use the alter script to compute the transformation?
If yes, I can help a lot but others members of the community should be able (please provide a minimal non-working file).
But if you are used to
Python and want to perform the conversion outside Telemac, you can try to use
pyproj and adapt this code (you will need PyTelTools):
from pyproj import Transformer
from pyteltools.slf import Serafin
with Serafin.Read('mesh_in.slf', 'fr') as resin:
resin.read_header()
resin.get_time()
old_x, old_y = resin.header.x, resin.header.y # EPSG = 2154 (shift because it was local)
print(old_x, old_y)
# Perform the coordinates transformation (from 2154 to 3945 EPSG code)
new_x, new_y = Transformer.from_crs("EPSG:2154", "EPSG:3945").transform(old_x, old_y)
print(new_x, new_y)
# Copy header and update mesh coordinates
output_header = resin.header.copy()
output_header.set_mesh_origin(0, 0) # Force it in case it was defined... but optional if avoid with care
output_header.x_stored = new_x
output_header.y_stored = new_y
with Serafin.Write('mesh_out.slf', 'fr', overwrite=True) as resout:
# Write header
resout.write_header(output_header)
# Write all frames
for time_index, time in enumerate(resin.time):
values = resin.read_vars_in_frame(time_index)
resout.write_entire_frame(output_header, time, values)
The log should display something like:
Reading the input file: "mesh_in.slf" of size 5833520 bytes
Format " " is unknown and is forced to "SERAFIN "
[960476.77941895 960481.07867432 960484.20278931 ... 962501.90649414
962503.53930664 962505.17163086] [6559274.54394531 6559320.9140625 6559256.08398438 ... 6559386.18652344
6559386.66308594 6559387.13964844]
[1960745.00535999 1960749.35945607 1960752.41615961 ... 1962772.3077349
1962773.94272584 1962775.57722802] [4325811.43998877 4325857.85244269 4325792.95323121 ... 4325920.98252655
4325921.45778086 4325921.9330357 ]
Writing the output file: "mesh_out.slf"