From 8a33648acb8cd0712a56bf78f86f42e08c2fb030 Mon Sep 17 00:00:00 2001 From: Prisca van der Sluis Date: Tue, 20 Feb 2024 12:41:24 +0100 Subject: [PATCH] Add function for the transformation of a crs for ugrid --- netcdf_to_gltf_converter/netcdf/ugrid/wrapper.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/netcdf_to_gltf_converter/netcdf/ugrid/wrapper.py b/netcdf_to_gltf_converter/netcdf/ugrid/wrapper.py index 5e13fc1..3f2bfbd 100644 --- a/netcdf_to_gltf_converter/netcdf/ugrid/wrapper.py +++ b/netcdf_to_gltf_converter/netcdf/ugrid/wrapper.py @@ -58,7 +58,17 @@ def node_coordinates(self) -> np.ndarray: np.ndarray: An ndarray of floats with shape (n, 2). Each row represents one node and contains the x- and y-coordinate. """ return self._ugrid2d.node_coordinates + + def transform_coordinate_system(self, source_crs: int, target_crs: int): + """Transform the coordinates to another coordinate system. + Args: + source_crs (int): EPSG from the source coordinate system. + target_crs (int): EPSG from the target coordinate system. + """ + self._ugrid2d.set_crs(epsg=source_crs) + self._ugrid2d = self._ugrid2d.to_crs(epsg=target_crs) + @property def fill_value(self) -> int: """Get the fill value.