NetCDF grdview problem

Hello,
I want to create 3d map from asc point data. I’ve got 2 asc files in EPSG2180. I had merged their in Qgis and exported as netCDF in EPSG4326. I try to open this file via code:

import pygmt as gmt
import xarray as xr

mapa = gmt.Figure()

grd = xr.open_dataset('nmt.nc')
grd2 = gmt.load_dataarray(grd)

mapa.grdview(
    grid=grd2,
    perspective=[130, 30],
    frame=["xa", "ya", "WSnE"],
    projection="M15c",
    zsize="1.5c",
)

mapa.savefig('map1.png')

but there is error:

ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', 'h5netcdf', 'scipy', 'cfgrib', 'pydap', 'zarr']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies, see:
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
https://docs.xarray.dev/en/stable/user-guide/io.html

I installed all dependencies. Any idea how to solve this?

Thanks

Hello @reg0edit,
welcome to the GMT forum :slightly_smiling_face: !

Your error message looks to me more like an issue during opening your netCDF file with xarray rather than a PyGMT or GMT related problem. Probably already the following code leads to your error message, correct?

import xarray as xr
grd = xr.open_dataset('nmt.nc')

I feel it would be helpful, when you please provide your input data. Currently, it is difficult to infer what is going wrong in detail.

And why complicate? Why just not?

mapa.grdview(
    grid='nmt.nc')
...