Thanks! I ve tried that, its called drapegrid in PyGMT but I am getting errors everytime I use that argument I get errors, I’ve tried givin it a raster in .tif, and xarray data array, georeferencedd png and a single channel .nc files and I always get an error.
This is my code:
fig = pygmt.Figure()
fig.grdview(
grid=grid,
#drapegrid="filepath.tif",
drapegrid=phase # is also the file path of the .tif file,
perspective=[-130, 30],
frame=["nSwWZ", "af", "zaf+lElevación (m s.n.m.)"],
projection="M15c",
zsize="3c",
surftype="s",
shading = True,
plane="-1000+ggrey",
contourpen="0.1p",
transparency=50,
)
fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])
fig.show()
And this is the error
OSError Traceback (most recent call last)
Cell In[18], line 2
1 fig = pygmt.Figure()
----> 2 fig.grdview(
3 grid=grid,
4 #drapegrid="filepath.tif",
5 drapegrid=phase,
6 # Set the azimuth to -130 (230) degrees and the elevation to 30 degrees
7 perspective=[180, 90],
8 frame=["nSwWZ", "af", "zaf+lElevación (m s.n.m.)"],
9 projection="M15c",
10 zsize="3c",
11 surftype="s",
12 shading = True,
13 plane="-1000+ggrey",
14 # Set the contour pen thickness to "0.1p"
15 contourpen="0.1p",
16 transparency=50,
17 )
18 fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])
19 fig.show()
File ~\anaconda3\lib\site-packages\pygmt\helpers\decorators.py:609, in use_alias.<locals>.alias_decorator.<locals>.new_module(*args, **kwargs)
603 msg = (
604 "Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. "
605 "Use Figure.shift_origin(yshift=...) instead."
606 )
607 raise GMTInvalidInput(msg)
--> 609 return module_func(*args, **kwargs)
File ~\anaconda3\lib\site-packages\pygmt\helpers\decorators.py:773, in kwargs_to_strings.<locals>.converter.<locals>.new_module(*args, **kwargs)
770 bound.arguments["kwargs"][arg] = newvalue
772 # Execute the original function and return its output
--> 773 return module_func(*bound.args, **bound.kwargs)
File ~\anaconda3\lib\site-packages\pygmt\src\grdview.py:155, in grdview(self, grid, **kwargs)
148 with (
149 lib.virtualfile_in(check_kind="raster", data=grid) as vingrd,
150 lib.virtualfile_in(
151 check_kind="raster", data=kwargs.get("G"), required_data=False
152 ) as vdrapegrid,
153 ):
154 kwargs["G"] = vdrapegrid
--> 155 lib.call_module(
156 module="grdview", args=build_arg_list(kwargs, infile=vingrd)
157 )
File ~\anaconda3\lib\site-packages\pygmt\clib\session.py:657, in Session.call_module(self, module, args)
652 else:
653 raise GMTInvalidInput(
654 "'args' must be either a string or a list of strings."
655 )
--> 657 status = c_call_module(self.session_pointer, module.encode(), mode, argv)
658 if status != 0:
659 raise GMTCLibError(
660 f"Module '{module}' failed with status code {status}:\n{self._error_message}"
661 )
OSError: exception: access violation reading 0x0000000000000150