Commit deb8f63a authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

optional xarray import

parent cf4d612f
Pipeline #10920 passed with stages
in 3 minutes and 50 seconds
......@@ -34,6 +34,12 @@ from enum import Enum
import platform
import ctypes as c
try :
import xarray as xr
xarray_available = True
except:
xarray_available = False
def log(txt, title=False):
decorator = " * " if title else ""
......
......@@ -422,6 +422,9 @@ def convert_to_ugrid_mesh_file(input_filename: str,
projection: the projection assigned to the mnt layer
output_filename : netcdf ugrid mesh file (.nc)
"""
if not _tools.xarray_available:
raise ValueError("The xarray python library is required to write ugrid files.")
_tools.log("Convert \"{}\" into \"{}\"".format(input_filename,
output_filename), True)
gmsh.model.add(str(_tools.uuid.uuid4()))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment