From: Paul RASCLE Date: Mon, 19 Oct 2020 13:15:49 +0000 (+0200) Subject: bug EDF #22200: fields are lost when change coordinates X-Git-Tag: SH_V2_2_0~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=70d501aa44cbf7929692bf9d094c06cdd28c2a8a;p=modules%2Fhydro.git bug EDF #22200: fields are lost when change coordinates --- diff --git a/src/HYDROTools/changeCoords.py b/src/HYDROTools/changeCoords.py index 8573a13b..c88036ce 100644 --- a/src/HYDROTools/changeCoords.py +++ b/src/HYDROTools/changeCoords.py @@ -1,4 +1,5 @@ +import shutil import numpy as np import MEDLoader as ml import medcoupling as mc @@ -29,6 +30,9 @@ def changeCoords(fileIn, fileOut, epsgIn=2154, epsgOut=2154, offsetXin=0, offset O if OK """ # TODO: do we need to transform the exception in return codes ? + if fileOut != fileIn: + shutil.copyfile(fileIn, fileOut) + if epsgIn != epsgOut: crs_in = CRS.from_epsg(epsgIn) crs_out = CRS.from_epsg(epsgOut) @@ -65,5 +69,5 @@ def changeCoords(fileIn, fileOut, epsgIn=2154, epsgOut=2154, offsetXin=0, offset ncoords.setInfoOnComponents(["X [m]", "Y [m]"]) meshMEDFileRead.setCoords(ncoords) - meshMEDFileRead.write(fileOut, 2) + meshMEDFileRead.write(fileOut, 0) return 0